Files
P2Pix-Front-End/.github/workflows/ipfs-release.yml
2026-03-05 22:30:50 -03:00

72 lines
2.0 KiB
YAML

name: Deploy to IPFS
on:
push:
branches:
- develop
workflow_dispatch:
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-only
- name: Deploy via RSYNC
uses: up9cloud/action-rsync@master
env:
USER: ${{secrets.SSH_USER}}
HOST: ${{secrets.SSH_HOST}}
KEY: ${{secrets.SSH_KEY}}
SOURCE: dist/
TARGET: /
- name: Deploy to IPFS
uses: ipshipyard/ipfs-deploy-action@v1
id: deploy
with:
path-to-deploy: dist
set-github-status: false
set-pr-comment: false
kubo-api-url: ${{ secrets.KUBO_API_URL }}
kubo-api-auth: ${{ secrets.KUBO_API_AUTH }}
upload-car-artifact: false
- name: Install Pinata CLI
if: secrets.PINATA_JWT != ''
shell: bash
run: curl -fsSL https://cli.pinata.cloud/install | bash
- name: Authenticate Pinata CLI (write JWT to file)
if: secrets.PINATA_JWT != ''
env:
PINATA_JWT: ${{ secrets.PINATA_JWT }}
run: |
echo -n "$PINATA_JWT" > ~/.pinata-files-cli
- name: Upload build output to Pinata
if: secrets.PINATA_JWT != ''
id: pinata_upload
run: |
export PATH="$HOME/.local/share/pinata/:$PATH"
VERSION=$(jq -r .version package.json)
UPLOAD_JSON=$(pinata upload --group "${{ secrets.PINATA_GROUP }}" --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 upload output. Aborting."
echo "Upload output: $UPLOAD_JSON"
exit 1
fi
echo "CID=$CID" >> $GITHUB_OUTPUT