Skip to content

Commit 0d3ba8a

Browse files
committed
chore(ci): migrate from Fleek to GitHub Actions
- replace ci.yml with build/deploy workflow pattern - deploy to IPFS cluster with DNSLink updates via DNSimple - deploy to GitHub Pages as HTTPS fallback - PR builds get 90-day pin expiration
1 parent e24816d commit 0d3ba8a

File tree

3 files changed

+151
-45
lines changed

3 files changed

+151
-45
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Build workflow - runs for both PRs and main branch pushes
2+
# This workflow builds the website without access to secrets
3+
# For PRs: Runs on untrusted fork code safely (using pull_request event, not pull_request_target)
4+
# For main: Builds and uploads artifacts for deployment
5+
# Artifacts are passed to the deploy workflow which has access to secrets
6+
7+
name: Build
8+
9+
permissions:
10+
contents: read
11+
12+
on:
13+
push:
14+
branches:
15+
- main
16+
pull_request:
17+
branches:
18+
- main
19+
20+
env:
21+
BUILD_PATH: 'build'
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: '24'
40+
cache: 'npm'
41+
42+
- name: Install dependencies
43+
run: npm ci --prefer-offline --no-audit --progress=false
44+
45+
- name: Build project
46+
run: npm run build
47+
48+
# Upload artifact for deploy workflow
49+
- name: Upload build artifact
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: website-build-${{ github.run_id }}
53+
path: ${{ env.BUILD_PATH }}
54+
retention-days: 1

.github/workflows/ci.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Deploy workflow - triggered by workflow_run after successful build
2+
# This workflow has access to secrets but never executes untrusted code
3+
# It only downloads and deploys pre-built artifacts from the build workflow
4+
# Security: Fork code cannot access secrets as it only runs in build workflow
5+
# Deploys to IPFS for all branches and GitHub Pages for main branch only
6+
7+
name: Deploy
8+
9+
# Explicitly declare permissions
10+
permissions:
11+
actions: read
12+
contents: read
13+
pull-requests: write
14+
statuses: write
15+
16+
on:
17+
workflow_run:
18+
workflows: ["Build"]
19+
types: [completed]
20+
21+
env:
22+
BUILD_PATH: 'website-build'
23+
24+
jobs:
25+
deploy-ipfs:
26+
if: github.event.workflow_run.conclusion == 'success'
27+
runs-on: ubuntu-latest
28+
outputs:
29+
cid: ${{ steps.deploy.outputs.cid }}
30+
environment:
31+
name: 'ipfs-publish'
32+
steps:
33+
- name: Download build artifact
34+
uses: actions/download-artifact@v4
35+
with:
36+
name: website-build-${{ github.event.workflow_run.id }}
37+
path: ${{ env.BUILD_PATH }}
38+
run-id: ${{ github.event.workflow_run.id }}
39+
github-token: ${{ github.token }}
40+
41+
- name: Deploy to IPFS
42+
uses: ipshipyard/ipfs-deploy-action@v1
43+
id: deploy
44+
with:
45+
path-to-deploy: ${{ env.BUILD_PATH }}
46+
cluster-url: "/dnsaddr/ipfs-websites.collab.ipfscluster.io"
47+
cluster-user: ${{ secrets.CLUSTER_USER }}
48+
cluster-password: ${{ secrets.CLUSTER_PASSWORD }}
49+
cluster-pin-expire-in: ${{ github.event.workflow_run.head_branch != 'main' && '2160h' || '' }}
50+
github-token: ${{ github.token }}
51+
52+
dnslink-update:
53+
runs-on: ubuntu-latest
54+
needs: deploy-ipfs
55+
if: github.event.workflow_run.head_branch == 'main'
56+
environment:
57+
name: 'dnslink'
58+
url: "https://dnslink.dev/"
59+
steps:
60+
- name: Update DNSLink
61+
uses: ipshipyard/dnslink-action@v1
62+
with:
63+
cid: ${{ needs.deploy-ipfs.outputs.cid }}
64+
dnslink_domain: 'dnslink.dev'
65+
dnsimple_token: ${{ secrets.DNSIMPLE_TOKEN }}
66+
dnsimple_account_id: ${{ secrets.DNSIMPLE_ACCOUNT_ID }}
67+
github_token: ${{ github.token }}
68+
set_github_status: true
69+
70+
deploy-gh-pages:
71+
if: |
72+
github.event.workflow_run.conclusion == 'success' &&
73+
github.event.workflow_run.head_branch == 'main'
74+
runs-on: ubuntu-latest
75+
permissions:
76+
pages: write
77+
id-token: write
78+
environment:
79+
name: github-pages
80+
url: ${{ steps.deployment.outputs.page_url }}
81+
steps:
82+
- name: Download build artifact
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: website-build-${{ github.event.workflow_run.id }}
86+
path: website-build
87+
run-id: ${{ github.event.workflow_run.id }}
88+
github-token: ${{ github.token }}
89+
90+
- name: Upload Pages artifact
91+
uses: actions/upload-pages-artifact@v3
92+
with:
93+
path: website-build
94+
95+
- name: Deploy to GitHub Pages
96+
id: deployment
97+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)