Skip to content

Commit 178f23d

Browse files
committed
ci: configure GitHub Actions to deploy to GitHub Pages
1 parent 45dcf61 commit 178f23d

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
17+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: false
21+
22+
jobs:
23+
# Build job
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Setup Python
31+
uses: actions/setup-python@v4
32+
with:
33+
python-version: '3.x'
34+
35+
- name: Setup Just
36+
uses: extractions/setup-just@v3
37+
38+
- name: Build project
39+
run: |
40+
just build-new
41+
42+
- name: Prepare GitHub Pages content
43+
run: |
44+
# Copy standalone build to pages directory
45+
mkdir -p pages
46+
cp -r dist/standalone/* pages/
47+
48+
# Ensure index.html exists
49+
if [ ! -f pages/index.html ]; then
50+
cp pages/standalone.html pages/index.html
51+
fi
52+
53+
- name: Setup Pages
54+
uses: actions/configure-pages@v4
55+
56+
- name: Upload artifact
57+
uses: actions/upload-pages-artifact@v3
58+
with:
59+
path: './pages'
60+
61+
# Deployment job
62+
deploy:
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
runs-on: ubuntu-latest
67+
needs: build
68+
if: github.ref == 'refs/heads/main'
69+
steps:
70+
- name: Deploy to GitHub Pages
71+
id: deployment
72+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)