-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (90 loc) · 2.87 KB
/
Copy pathdeploy-web.yml
File metadata and controls
104 lines (90 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Deploy fizzyed.it: this repo's static landing (docs/) + the fizzy browser app
# built from a checkout of fizzyedit/fizzy (zig build web → site/app/).
#
# One-time repo setup: Settings → Pages → Build and deployment → Source: GitHub
# Actions. Set the custom domain to fizzyed.it (docs/CNAME is copied into the
# published artifact). The fizzy app source is public, so checking it out needs
# no token.
#
# Rebuilds on: this repo's docs/ pushes, a repository_dispatch from
# fizzyedit/fizzy (app source / new release), or a manual run.
name: Deploy website
on:
push:
branches: [main]
paths:
- "docs/**"
- ".github/workflows/deploy-web.yml"
repository_dispatch:
types: [fizzy-updated]
workflow_dispatch:
concurrency:
group: deploy-website
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
env:
ZIG_VERSION: "0.16.0"
# Branch or tag of fizzyedit/fizzy whose web app is published to /app/.
# Set to a release tag (e.g. v0.0.18) if you want /app/ to track stable
# releases instead of main.
FIZZY_REF: "main"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout website (docs/, CNAME)
uses: actions/checkout@v4
- name: Checkout fizzy app source
uses: actions/checkout@v4
with:
repository: fizzyedit/fizzy
ref: ${{ env.FIZZY_REF }}
path: fizzy
- name: Pre-create Zig global cache tmp/
run: mkdir -p "$GITHUB_WORKSPACE/zig-global-cache/tmp"
- uses: mlugg/setup-zig@v2
with:
version: ${{ env.ZIG_VERSION }}
cache-key: ${{ hashFiles('fizzy/build.zig.zon') }}
- name: Fetch dependencies (with retries)
working-directory: fizzy
env:
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/zig-global-cache
run: |
n=0
until [ "$n" -ge 5 ]; do
zig build --fetch && break
n=$((n+1))
echo "Fetch attempt $n failed, sleeping $((n*10))s before retry..."
sleep $((n*10))
done
if [ "$n" -ge 5 ]; then
echo "All fetch attempts failed"; exit 1
fi
- name: Build web app (ReleaseSafe)
working-directory: fizzy
env:
ZIG_GLOBAL_CACHE_DIR: ${{ github.workspace }}/zig-global-cache
run: zig build web -Doptimize=ReleaseSafe
- name: Assemble site
run: |
mkdir -p site/app
cp -R docs/. site/
cp -R fizzy/zig-out/web/. site/app/
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4