From 183fd698a98723758eb555d58e38a700d16e4de2 Mon Sep 17 00:00:00 2001 From: Jefferson Mantovani Date: Thu, 22 Jan 2026 10:52:37 -0300 Subject: [PATCH 1/4] chore: test pinata upload --- .github/workflows/ipfs-release.yml | 43 ++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ipfs-release.yml diff --git a/.github/workflows/ipfs-release.yml b/.github/workflows/ipfs-release.yml new file mode 100644 index 0000000..ec101d6 --- /dev/null +++ b/.github/workflows/ipfs-release.yml @@ -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 \ No newline at end of file diff --git a/package.json b/package.json index 646d1ac..3c2ae62 100644 --- a/package.json +++ b/package.json @@ -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", From d686fca363e40d0f34b1ea734e28094c634eafdf Mon Sep 17 00:00:00 2001 From: Jefferson Mantovani Date: Thu, 22 Jan 2026 10:53:33 -0300 Subject: [PATCH 2/4] chore: test pinata upload --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3c2ae62..646d1ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p2pix-front-end", - "version": "1.2.0", + "version": "1.1.0", "scripts": { "start": "vite --host=0.0.0.0 --port 3000", "build": "run-p type-check build-only", From 3c8e9c026259bacd6402ce7eeb4893f6ee442604 Mon Sep 17 00:00:00 2001 From: Jefferson Mantovani Date: Thu, 22 Jan 2026 10:58:55 -0300 Subject: [PATCH 3/4] fix: ipfs release script --- .github/workflows/ipfs-release.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ipfs-release.yml b/.github/workflows/ipfs-release.yml index ec101d6..dc23fd3 100644 --- a/.github/workflows/ipfs-release.yml +++ b/.github/workflows/ipfs-release.yml @@ -1,9 +1,9 @@ -name: Deploy to IPFS and Update Gist +name: Deploy to IPFS on: push: branches: - - release + - develop jobs: build-and-deploy: @@ -23,21 +23,22 @@ jobs: - name: Build SPA run: npm run build - - name: Upload build output to Pinata (API) - id: pinata_upload + - name: Authenticate Pinata CLI (write JWT to file) env: PINATA_JWT: ${{ secrets.PINATA_JWT }} run: | + echo -n "$PINATA_JWT" > ~/.pinata-files-cli + + - name: Upload build output to Pinata + id: pinata_upload + run: | + export PATH="$HOME/.local/share/pinata/:$PATH" 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) + UPLOAD_JSON=$(pinata upload --name "p2pix_${VERSION}" ./dist) + CID=$(echo "$UPLOAD_JSON" | jq -r .cid) if [ -z "$CID" ] || [ "$CID" = "null" ]; then - echo "Error: Could not parse CID from Pinata API response. Aborting." - echo "Upload output: $RESPONSE" + echo "Error: Could not parse CID from Pinata upload output. Aborting." + echo "Upload output: $UPLOAD_JSON" exit 1 fi echo "CID=$CID" >> $GITHUB_OUTPUT \ No newline at end of file From 674948120c07961f765a4a3d2bc2ccfeed864728 Mon Sep 17 00:00:00 2001 From: Jefferson Mantovani Date: Thu, 22 Jan 2026 11:00:50 -0300 Subject: [PATCH 4/4] fix: remove old github workflows --- .github/workflows/cd.yml | 60 ------------------------------------- .github/workflows/ci.yml | 64 ---------------------------------------- 2 files changed, 124 deletions(-) delete mode 100644 .github/workflows/cd.yml delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index ac38b77..0000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Deploy FrontEnd - -on: - push: - branches: [ main, develop ] - -jobs: - deploy-staging: - if: github.ref == 'refs/heads/develop' - runs-on: ubuntu-latest - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_STAGING }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STAGING }} - ENV_VARIABLE: ${{ secrets.ENV_STAGING }} - - steps: - - name: 🏗 Setup repo - uses: actions/checkout@v3 - - - name: 🏗 Config .env - run: echo "$ENV_VARIABLE" > .env - - - name: 🏗 Install Vercel CLI - run: npm install --global vercel@latest - - - name: 🏗 Pull staging app from vercel environment - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: 📦 Build staging app artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: 📦 Deploy staging app artifacts to vercel - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - deploy-production: - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} - ENV_VARIABLE: ${{ secrets.ENV_PROD }} - - steps: - - name: 🏗 Setup repo - uses: actions/checkout@v3 - - - name: 🏗 Config .env - run: echo "$ENV_VARIABLE" > .env - - - name: 🏗 Install Vercel CLI - run: npm install --global vercel@latest - - - name: 🏗 Pull production vercel environment - run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: 📦 Build app artifacts - run: vercel build --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: 📦 Deploy app artifacts to vercel in production - run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_AUTH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 01b910c..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: CI script - -on: - push: - branches: [ main, develop ] - pull_request: - branches: [ main, develop ] - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: 🏗 Setup repo - uses: actions/checkout@v3 - - - name: 🏗 Setup node - uses: actions/setup-node@v3 - with: - node-version: 16.x - cache: 'yarn' - - - name: 🏗 Install dependencies - run: yarn - - - name: 📦 Lint with eslint - run: yarn lint - - build: - runs-on: ubuntu-latest - env: - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID_STAGING }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STAGING }} - steps: - - name: 🏗 Setup repo - uses: actions/checkout@v3 - - - name: 🏗 Install Vercel CLI - run: npm install --global vercel@latest - - - name: 🏗 Pull staging app from vercel environment - run: vercel pull --yes --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - - name: 📦 Build staging app artifacts - run: vercel build --token=${{ secrets.VERCEL_AUTH_TOKEN }} - - test-coverage: - name: SonarCloud - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: 🏗 Install dependencies - run: yarn - - - name: 📦 Test and coverage - run: yarn coverage - - - name: 📦 SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file