From dd43d158210183fab129bf5c3dc52ed47b26f3a5 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 1 Oct 2025 11:19:25 -0400 Subject: [PATCH 1/5] fix: use safe two-workflow pattern --- .github/workflows/filecoin-pin-build.yml | 34 ++++++++++++++++++ .github/workflows/filecoin-pin-upload.yml | 43 ++++++++--------------- 2 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/filecoin-pin-build.yml diff --git a/.github/workflows/filecoin-pin-build.yml b/.github/workflows/filecoin-pin-build.yml new file mode 100644 index 00000000..1719ab74 --- /dev/null +++ b/.github/workflows/filecoin-pin-build.yml @@ -0,0 +1,34 @@ +name: Build Site + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +permissions: + contents: read + actions: write # needed to upload artifacts + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Install dependencies + run: npm ci + + - name: Build site + run: npm run build + + - name: Create CAR file and save metadata + uses: sgtpooki/filecoin-upload-action@main + with: + path: public diff --git a/.github/workflows/filecoin-pin-upload.yml b/.github/workflows/filecoin-pin-upload.yml index 06e2ce86..630adc30 100644 --- a/.github/workflows/filecoin-pin-upload.yml +++ b/.github/workflows/filecoin-pin-upload.yml @@ -1,43 +1,30 @@ -name: Upload site to Filecoin +name: Upload to Filecoin on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - workflow_dispatch: + workflow_run: + workflows: ["Build Site"] + types: [completed] + workflow_dispatch: # Allow manual triggers permissions: contents: read - actions: read - pull-requests: write + actions: read # needed to download artifacts + pull-requests: write # needed to comment on PRs jobs: upload: + # Only upload if build succeeded + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.FILECOIN_PIN_GH_TOKEN }} - if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }} - runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20.x - - - name: Install dependencies - run: npm ci - - - name: Build site - run: npm run build - - name: Upload to Filecoin uses: sgtpooki/filecoin-upload-action@main with: - privateKey: ${{ secrets.FILECOIN_WALLET_KEY }} - path: public - minDays: 30 - maxTopUp: ${{ github.event_name == 'pull_request' && '0.0001' || '0.01' }} + mode: upload + walletPrivateKey: ${{ secrets.FILECOIN_WALLET_KEY }} + minDays: "30" + # 0.0001 USDFC for PRs, 0.10 USDFC for main + maxTopUp: ${{ github.event.workflow_run.event == 'pull_request' && '0.0001' || '0.01' }} providerAddress: "0xa3971A7234a3379A1813d9867B531e7EeB20ae07" From fd9815c56e2e00887756b9cbdcbce6e48edb27da Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:06:17 -0400 Subject: [PATCH 2/5] fix: allow manual triggers --- .github/workflows/filecoin-pin-upload.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/filecoin-pin-upload.yml b/.github/workflows/filecoin-pin-upload.yml index 630adc30..1f2264ec 100644 --- a/.github/workflows/filecoin-pin-upload.yml +++ b/.github/workflows/filecoin-pin-upload.yml @@ -5,6 +5,11 @@ on: workflows: ["Build Site"] types: [completed] workflow_dispatch: # Allow manual triggers + inputs: + artifact_name: + description: 'Artifact name (for manual testing only, e.g., filecoin-build-pr-822)' + required: false + type: string permissions: contents: read From e4002f27994e535e7438dc76f011d6045abd6e62 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:13:48 -0400 Subject: [PATCH 3/5] fix: pass through artifact name --- .github/workflows/filecoin-pin-upload.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/filecoin-pin-upload.yml b/.github/workflows/filecoin-pin-upload.yml index 1f2264ec..d7d85770 100644 --- a/.github/workflows/filecoin-pin-upload.yml +++ b/.github/workflows/filecoin-pin-upload.yml @@ -28,6 +28,7 @@ jobs: uses: sgtpooki/filecoin-upload-action@main with: mode: upload + artifact_name: ${{ inputs.artifact_name }} # only used if manually input from the action trigger UI walletPrivateKey: ${{ secrets.FILECOIN_WALLET_KEY }} minDays: "30" # 0.0001 USDFC for PRs, 0.10 USDFC for main From 9aa8c52345df19320dcae04bd2e8ace976703d0b Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 1 Oct 2025 13:20:20 -0400 Subject: [PATCH 4/5] fix: include build_run_id for manual runs --- .github/workflows/filecoin-pin-upload.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/filecoin-pin-upload.yml b/.github/workflows/filecoin-pin-upload.yml index d7d85770..a3e27509 100644 --- a/.github/workflows/filecoin-pin-upload.yml +++ b/.github/workflows/filecoin-pin-upload.yml @@ -10,6 +10,10 @@ on: description: 'Artifact name (for manual testing only, e.g., filecoin-build-pr-822)' required: false type: string + build_run_id: + description: 'Build workflow run ID (find it in the build workflow URL)' + required: false + type: string permissions: contents: read @@ -29,6 +33,7 @@ jobs: with: mode: upload artifact_name: ${{ inputs.artifact_name }} # only used if manually input from the action trigger UI + build_run_id: ${{ inputs.build_run_id }} # only used if manually input from the action trigger UI walletPrivateKey: ${{ secrets.FILECOIN_WALLET_KEY }} minDays: "30" # 0.0001 USDFC for PRs, 0.10 USDFC for main From b4627b7ab3dfe14a391fffaca49dd8acd1f2242b Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Thu, 2 Oct 2025 12:26:58 -0400 Subject: [PATCH 5/5] chore: use specific commit sha for lotus-docs --- .github/workflows/filecoin-pin-build.yml | 2 +- .github/workflows/filecoin-pin-upload.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/filecoin-pin-build.yml b/.github/workflows/filecoin-pin-build.yml index 1719ab74..88b88fff 100644 --- a/.github/workflows/filecoin-pin-build.yml +++ b/.github/workflows/filecoin-pin-build.yml @@ -29,6 +29,6 @@ jobs: run: npm run build - name: Create CAR file and save metadata - uses: sgtpooki/filecoin-upload-action@main + uses: sgtpooki/filecoin-upload-action@641a2bf866d4ad0c47c98c0ddefaffdd4e628500 with: path: public diff --git a/.github/workflows/filecoin-pin-upload.yml b/.github/workflows/filecoin-pin-upload.yml index a3e27509..ab684ff6 100644 --- a/.github/workflows/filecoin-pin-upload.yml +++ b/.github/workflows/filecoin-pin-upload.yml @@ -29,7 +29,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.FILECOIN_PIN_GH_TOKEN }} steps: - name: Upload to Filecoin - uses: sgtpooki/filecoin-upload-action@main + uses: sgtpooki/filecoin-upload-action@641a2bf866d4ad0c47c98c0ddefaffdd4e628500 with: mode: upload artifact_name: ${{ inputs.artifact_name }} # only used if manually input from the action trigger UI @@ -38,4 +38,5 @@ jobs: minDays: "30" # 0.0001 USDFC for PRs, 0.10 USDFC for main maxTopUp: ${{ github.event.workflow_run.event == 'pull_request' && '0.0001' || '0.01' }} + # Note: this provider should not be set in prod, but while testing things, it's a reliable provider we can depend on. providerAddress: "0xa3971A7234a3379A1813d9867B531e7EeB20ae07"