chore: test pinata upload

This commit is contained in:
Jefferson Mantovani
2026-01-22 10:52:37 -03:00
parent 100aab6b42
commit 183fd698a9
2 changed files with 44 additions and 1 deletions

43
.github/workflows/ipfs-release.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Deploy to IPFS and Update Gist
on:
push:
branches:
- release
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install dependencies
run: npm ci
- name: Build SPA
run: npm run build
- name: Upload build output to Pinata (API)
id: pinata_upload
env:
PINATA_JWT: ${{ secrets.PINATA_JWT }}
run: |
VERSION=$(jq -r .version package.json)
zip -r dist.zip dist
RESPONSE=$(curl -sSL -X POST "https://api.pinata.cloud/pinning/pinFileToIPFS" \
-H "Authorization: Bearer $PINATA_JWT" \
-F "file=@dist.zip;type=application/zip" \
-F "pinataMetadata={\"name\":\"p2pix_${VERSION}\"};type=application/json")
CID=$(echo "$RESPONSE" | jq -r .IpfsHash)
if [ -z "$CID" ] || [ "$CID" = "null" ]; then
echo "Error: Could not parse CID from Pinata API response. Aborting."
echo "Upload output: $RESPONSE"
exit 1
fi
echo "CID=$CID" >> $GITHUB_OUTPUT

View File

@@ -1,6 +1,6 @@
{
"name": "p2pix-front-end",
"version": "1.1.0",
"version": "1.2.0",
"scripts": {
"start": "vite --host=0.0.0.0 --port 3000",
"build": "run-p type-check build-only",