Skip to content

Commit f9e0e6a

Browse files
ci(pages): publish committed html/ folder to GitHub Pages [opencode:arc/apex]
- Workflow triggers on html/** changes to main (and workflow_dispatch), uploads the html/ folder as a Pages artifact and deploys it - Un-ignore html/ so it can be committed as the published artifact - README: add a Publishing to GitHub Pages section
1 parent 02dc60b commit f9e0e6a

3 files changed

Lines changed: 71 additions & 1 deletion

File tree

.github/workflows/pages.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish to GitHub Pages
2+
3+
# Publishes the committed html/ folder to GitHub Pages.
4+
# The html/ folder is committed (it is not gitignored); regenerate it locally
5+
# by running `python main.py` whenever the source exhibition changes.
6+
7+
on:
8+
push:
9+
branches: [main]
10+
paths:
11+
- 'html/**'
12+
- '.github/workflows/pages.yml'
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: true
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Verify html/ exists
29+
run: test -f html/index.html
30+
31+
- uses: actions/configure-pages@v5
32+
33+
- uses: actions/upload-pages-artifact@v3
34+
with:
35+
path: html
36+
37+
deploy:
38+
needs: build
39+
runs-on: ubuntu-latest
40+
environment:
41+
name: github-pages
42+
url: ${{ steps.deploy.outputs.page_url }}
43+
permissions:
44+
pages: write
45+
id-token: write
46+
steps:
47+
- id: deploy
48+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ env/
2121

2222
# Output of the tool
2323
output/
24-
html/

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,29 @@ With no arguments it mirrors the SHARC exhibition into `./html/`.
3838
URL so they still load when online. Re-run from an unrestricted network to
3939
fill them in.
4040

41+
## Publishing to GitHub Pages
42+
43+
The `html/` folder is committed to the repo (it is the published artifact).
44+
A workflow at `.github/workflows/pages.yml` publishes it to GitHub Pages
45+
whenever `html/**` changes on `main`:
46+
47+
- In the repo **Settings → Pages → Build and deployment → Source**, select
48+
**GitHub Actions**.
49+
- Push (or merge) a change under `html/` to `main`. The workflow uploads the
50+
`html/` folder as a Pages artifact and deploys it. You can also run it
51+
manually via the Actions tab (**workflow_dispatch**).
52+
53+
To refresh the published mirror, regenerate it locally and commit the
54+
updated `html/` folder:
55+
56+
```bash
57+
pip install -r requirements.txt
58+
python main.py
59+
git add html
60+
git commit -m "docs: refresh html mirror"
61+
git push
62+
```
63+
4164
## License
4265

4366
MIT

0 commit comments

Comments
 (0)