Repository navigation
85 lines (73 loc) · 2.43 KB
/
Copy pathdeploy-pages.yml
File metadata and controls
85 lines (73 loc) · 2.43 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: Deploy to GitHub Pages
on:
push:
branches: [ dev-ts ] # ← Only trigger on pushes to dev-ts
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: ts/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: ts
# Mark the GitHub Pages build as alpha, with its build time, in the
# version string (shown in the title bar and About box). Only the
# checked-out copy is changed.
- name: Mark version as alpha with build time
run: |
BUILT=$(date -u '+%Y-%m-%d %H:%M UTC')
sed -E -i "s/(versionString: string = \"[^\"]*)\"/\1 (alpha $BUILT)\"/" ts/CirSim.ts
grep 'versionString: string = ".* (alpha .*)"' ts/CirSim.ts
- name: Build site
run: ./dist-offline.sh
# site/ has no index.html of its own (the app's entry point is
# circuitjs.html), so GitHub Pages 404s at the site root without this.
# Scoped to this workflow only — not added to ts/ or the other build
# scripts, which don't need it (dist.sh/dist-offline.sh deployments are
# placed under a path where the caller already knows to link straight
# to circuitjs.html, and the Electron app loads it directly by name).
- name: Add index.html redirect to circuitjs.html
run: |
cat > site/index.html <<'EOF'
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; url=circuitjs.html">
<title>CircuitJS</title>
</head>
<body>
<a href="circuitjs.html">CircuitJS</a>
</body>
</html>
EOF
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload site artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4