-
Notifications
You must be signed in to change notification settings - Fork 84
[DO NOT MERGE] fix: safer two workflow filecoin upload #822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
dd43d15
fd9815c
e4002f2
9aa8c52
b4627b7
8421502
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
Comment on lines
+17
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was surprised that there wasn't existing CI to hook into, but I guess that is abstracted away by a fleek app or something else |
||
|
|
||
| - name: Create CAR file and save metadata | ||
| uses: sgtpooki/filecoin-upload-action@641a2bf866d4ad0c47c98c0ddefaffdd4e628500 | ||
| with: | ||
| path: public | ||
|
Comment on lines
+32
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we also want to be explicit about the mode? |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,43 +1,42 @@ | ||||||
| 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 | ||||||
| inputs: | ||||||
| artifact_name: | ||||||
| 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 | ||||||
| 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 }} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Why do we need a special secret for this? |
||||||
| 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 | ||||||
| uses: sgtpooki/filecoin-upload-action@641a2bf866d4ad0c47c98c0ddefaffdd4e628500 | ||||||
| with: | ||||||
| privateKey: ${{ secrets.FILECOIN_WALLET_KEY }} | ||||||
| path: public | ||||||
| minDays: 30 | ||||||
| maxTopUp: ${{ github.event_name == 'pull_request' && '0.0001' || '0.01' }} | ||||||
| mode: upload | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume we'll also show how we can store previews with a different dataset. |
||||||
| 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 | ||||||
| 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" | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.