-
-
Notifications
You must be signed in to change notification settings - Fork 3
85 lines (73 loc) · 2.47 KB
/
Copy pathweb.yml
File metadata and controls
85 lines (73 loc) · 2.47 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
name: Publish Sandopolis Web
on:
workflow_dispatch:
push:
branches:
- main
- develop
tags:
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
jobs:
build-web:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Determine Zig version
id: zigver
shell: bash
run: |
version="$(sed -n 's/.*\.minimum_zig_version = "\(.*\)".*/\1/p' build.zig.zon)"
if [ -z "$version" ]; then
echo "Failed to read minimum_zig_version from build.zig.zon" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: ${{ steps.zigver.outputs.version }}
- name: Set build metadata
id: build_meta
shell: bash
run: |
echo "git_branch=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
echo "git_hash=${GITHUB_SHA::5}" >> "$GITHUB_OUTPUT"
echo "build_time=$(date -u '+%Y-%m-%d %H:%M UTC')" >> "$GITHUB_OUTPUT"
- name: Build WebAssembly module
run: zig build wasm -Dgit-branch="${{ steps.build_meta.outputs.git_branch }}" -Dgit-hash="${{ steps.build_meta.outputs.git_hash }}" -Dbuild-time="${{ steps.build_meta.outputs.build_time }}"
- name: Prepare publish directory
run: |
mkdir -p ./publish/img ./publish/fonts
cp -r ./web/. ./publish/
cp ./docs/assets/overlays/crt/*.png ./docs/assets/overlays/genesis/*.png ./publish/img/
cp ./src/frontend/fonts/ttf/JetBrainsMono-*.ttf ./publish/fonts/
cp ./zig-out/web/sandopolis.wasm ./publish/
# CREDITS.txt is part of web/ and copied by the recursive cp above.
# This guard fails the deploy if it ever goes missing.
test -f ./publish/CREDITS.txt
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./publish
deploy-web:
runs-on: ubuntu-latest
needs: build-web
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4