Files
P2Pix-Front-End/.github/workflows/deploy.yml
arthur 7887f50b1a ci(deploy): install contracts submodule via yarn before SPA build (#15)
The p2pix-smart-contracts submodule ships a yarn v4 lockfile that bun
cannot consume (UnsupportedYarnLockfileVersion). Install yarn in the
build container, check out the submodule, and run yarn install via a
new install:contracts package.json script. Then run wagmi:gen so
src/blockchain/abi.ts exists before vite build.

Co-authored-by: Arthur Abeilice <afa7789@gmail.com>
Reviewed-on: https://git.p2pix.co/doiim/p2pix-front-end/pulls/15
Co-authored-by: arthur <abeilice@kosmos.org>
Co-committed-by: arthur <abeilice@kosmos.org>
2026-06-02 01:41:01 +00:00

140 lines
3.7 KiB
YAML

name: Deploy to IPFS
on:
push:
branches: [main, develop]
tags: ['*']
pull_request:
branches: [main, develop]
workflow_dispatch:
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
container: node:lts
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install bun
run: npm install -g bun
- name: Install submodule deps (yarn 4 via corepack)
run: corepack enable && yarn --cwd p2pix-smart-contracts install --immutable
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Generate contract ABIs
env:
ALCHEMY_API_KEY: dummy
run: bun run wagmi:gen
- name: Build SPA
run: bun run build-only
- name: Upload dist artifact
# v3 pinned: Gitea Actions does not implement the v4 cache API
# (the runner returns ECONNREFUSED on getCacheEntry).
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
retention-days: 1
deploy-rsync:
needs: build
runs-on: ubuntu-latest
container: node:lts
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Deploy via RSYNC
uses: up9cloud/action-rsync@v1
env:
USER: ${{ secrets.SSH_USER }}
HOST: ${{ secrets.SSH_HOST }}
KEY: ${{ secrets.SSH_KEY }}
SOURCE: dist/
TARGET: ${{ github.ref_name }}
deploy-ipfs:
needs: build
runs-on: ubuntu-latest
container: node:lts
outputs:
cid: ${{ steps.ipfs.outputs.cid }}
steps:
- name: Install jq
run: apt-get update && apt-get install -y --no-install-recommends jq
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Deploy to IPFS
uses: ipshipyard/ipfs-deploy-action@v1
id: ipfs
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
deploy-pinata:
needs: [deploy-ipfs, deploy-rsync]
runs-on: ubuntu-latest
container: node:lts
steps:
- name: Install jq
run: apt-get update && apt-get install -y --no-install-recommends jq
- uses: actions/checkout@v4
with:
sparse-checkout: package.json
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Install Pinata CLI
run: curl -fsSL https://cli.pinata.cloud/install | bash
- name: Authenticate Pinata CLI
env:
PINATA_JWT: ${{ secrets.PINATA_JWT }}
run: echo -n "$PINATA_JWT" > ~/.pinata-files-cli
- name: Upload to Pinata
env:
PINATA_GROUP: ${{ secrets.PINATA_GROUP }}
IPFS_CID: ${{ needs.deploy-ipfs.outputs.cid }}
run: |
export PATH="$HOME/.local/share/pinata/:$PATH"
VERSION=$(jq -r .version package.json)
UPLOAD_JSON=$(pinata upload --group "$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. Output: $UPLOAD_JSON"
exit 1
fi
{
echo "## Deploy Summary"
echo "- IPFS CID (kubo): \`$IPFS_CID\`"
echo "- Pinata CID: \`$CID\`"
echo "- Version: \`$VERSION\`"
} >> "$GITHUB_STEP_SUMMARY"