Skip to content

Commit 5d45734

Browse files
committed
chore(ci): migrate from Fleek to GitHub Actions
- add build.yml workflow for building the site - add deploy.yml workflow with GitHub Pages deployment - remove Fleek daily-build workflow - IPFS and DNSLink deployment commented out for future use Fleek hosting shuts down Jan 31, 2026 Related: ipshipyard/waterworks-community#23
1 parent e3843e1 commit 5d45734

File tree

3 files changed

+162
-11
lines changed

3 files changed

+162
-11
lines changed

.github/workflows/build.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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: 'dist'
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: '20'
40+
cache: 'npm'
41+
42+
- name: Install dependencies
43+
run: npm ci --prefer-offline --no-audit --progress=false
44+
45+
- name: Generate sitemap
46+
run: npm run sitemap
47+
48+
- name: Build data
49+
run: npm run scripts:build:data -- --dry-run=false
50+
51+
- name: Run tests
52+
run: npm run test:jest
53+
54+
- name: Build project
55+
run: npm run build
56+
57+
# Upload artifact for deploy workflow
58+
- name: Upload build artifact
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: website-build-${{ github.run_id }}
62+
path: ${{ env.BUILD_PATH }}
63+
retention-days: 1

.github/workflows/daily-build.yml

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

.github/workflows/deploy.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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 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+
# TODO: uncomment when IPFS hosting is needed
26+
# deploy-ipfs:
27+
# if: github.event.workflow_run.conclusion == 'success'
28+
# runs-on: ubuntu-latest
29+
# outputs:
30+
# cid: ${{ steps.deploy.outputs.cid }}
31+
# environment:
32+
# name: 'ipfs-publish'
33+
# steps:
34+
# - name: Download build artifact
35+
# uses: actions/download-artifact@v4
36+
# with:
37+
# name: website-build-${{ github.event.workflow_run.id }}
38+
# path: ${{ env.BUILD_PATH }}
39+
# run-id: ${{ github.event.workflow_run.id }}
40+
# github-token: ${{ github.token }}
41+
#
42+
# - name: Deploy to IPFS
43+
# uses: ipshipyard/ipfs-deploy-action@v1
44+
# id: deploy
45+
# with:
46+
# path-to-deploy: ${{ env.BUILD_PATH }}
47+
# cluster-url: "/dnsaddr/ipfs-websites.collab.ipfscluster.io"
48+
# cluster-user: ${{ secrets.CLUSTER_USER }}
49+
# cluster-password: ${{ secrets.CLUSTER_PASSWORD }}
50+
# cluster-pin-expire-in: ${{ github.event.workflow_run.head_branch != 'main' && '2160h' || '' }}
51+
# github-token: ${{ github.token }}
52+
53+
# TODO: uncomment when DNSLink is needed
54+
# dnslink-update:
55+
# runs-on: ubuntu-latest
56+
# needs: deploy-ipfs
57+
# if: github.event.workflow_run.head_branch == 'main'
58+
# environment:
59+
# name: 'cf-dnslink'
60+
# url: "https://protoschool.ipns.inbrowser.link/"
61+
# steps:
62+
# - name: Update DNSLink
63+
# uses: ipshipyard/dnslink-action@v1
64+
# with:
65+
# cid: ${{ needs.deploy-ipfs.outputs.cid }}
66+
# dnslink_domain: 'protoschool.dnslinks.ipshipyard.tech'
67+
# cf_zone_id: ${{ secrets.CF_DNS_ZONE_ID }}
68+
# cf_auth_token: ${{ secrets.CF_DNS_AUTH_TOKEN }}
69+
# github_token: ${{ github.token }}
70+
# set_github_status: true
71+
72+
deploy-gh-pages:
73+
if: |
74+
github.event.workflow_run.conclusion == 'success' &&
75+
github.event.workflow_run.head_branch == 'main'
76+
runs-on: ubuntu-latest
77+
permissions:
78+
pages: write
79+
id-token: write
80+
environment:
81+
name: github-pages
82+
url: ${{ steps.deployment.outputs.page_url }}
83+
steps:
84+
- name: Download build artifact
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: website-build-${{ github.event.workflow_run.id }}
88+
path: website-build
89+
run-id: ${{ github.event.workflow_run.id }}
90+
github-token: ${{ github.token }}
91+
92+
- name: Upload Pages artifact
93+
uses: actions/upload-pages-artifact@v3
94+
with:
95+
path: website-build
96+
97+
- name: Deploy to GitHub Pages
98+
id: deployment
99+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)