Skip to content

Commit 2064aea

Browse files
Merge branch 'main' into chore/sweeps-2-4
2 parents 9a921e4 + ecc1245 commit 2064aea

1 file changed

Lines changed: 60 additions & 23 deletions

File tree

.github/workflows/pages.yml

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,90 @@
1-
name: GitHub Pages (Ddraig SSG)
1+
# SPDX-License-Identifier: MPL-2.0
2+
# GitHub Pages via casket-ssg (hyperpolymath's pure-Haskell static site generator).
3+
# Replaces the orphan one-off Pages deployment with a reproducible build.
4+
name: GitHub Pages
5+
26
on:
37
push:
4-
branches: [main, master]
8+
branches: [main]
59
workflow_dispatch:
10+
611
permissions:
712
contents: read
813
pages: write
914
id-token: write
15+
16+
# Serialise Pages deploys; never cancel an in-flight deploy.
1017
concurrency:
1118
group: "pages"
1219
cancel-in-progress: false
20+
1321
jobs:
1422
build:
23+
timeout-minutes: 20
1524
runs-on: ubuntu-latest
16-
timeout-minutes: 15
17-
container:
18-
image: ghcr.io/stefan-hoeck/idris2-pack@sha256:f0758996a931fb35d9ecb1de273c4d59dabe2a09b433afc7e357f65a08b7e1ff
1925
steps:
20-
- name: Checkout Site
21-
uses: actions/checkout@v4
22-
- name: Checkout Ddraig SSG
23-
uses: actions/checkout@v4
26+
- name: Checkout
27+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
28+
29+
- name: Checkout casket-ssg
30+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2431
with:
25-
repository: hyperpolymath/ddraig-ssg
26-
path: .ddraig-ssg
27-
- name: Compile Ddraig
28-
working-directory: .ddraig-ssg
29-
run: idris2 Ddraig.idr -o ddraig
32+
repository: hyperpolymath/casket-ssg
33+
path: .casket-ssg
34+
35+
- name: Setup GHCup
36+
uses: haskell-actions/setup@cd0d9bdd65b20557f41bea4dbe43d0b5fbbfe553 # v2.11.0
37+
with:
38+
ghc-version: '9.8.2'
39+
cabal-version: '3.10'
40+
41+
- name: Cache Cabal
42+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v4
43+
with:
44+
path: |
45+
~/.cabal/packages
46+
~/.cabal/store
47+
.casket-ssg/dist-newstyle
48+
key: ${{ runner.os }}-casket-${{ hashFiles('.casket-ssg/casket-ssg.cabal') }}
49+
50+
- name: Build casket-ssg
51+
working-directory: .casket-ssg
52+
run: cabal build
53+
3054
- name: Build site
3155
run: |
32-
mkdir -p src
33-
if [ ! -f src/index.md ] && [ -f README.md ]; then
34-
cp README.md src/index.md
35-
elif [ ! -f src/index.md ]; then
36-
echo "# ${GITHUB_REPOSITORY}" > src/index.md
56+
mkdir -p site _site
57+
# Seed site/index.md from README if the author hasn't provided one.
58+
if [ ! -f site/index.md ]; then
59+
{
60+
echo "---"
61+
echo "title: $(basename "$PWD")"
62+
echo "date: $(date +%Y-%m-%d)"
63+
echo "---"
64+
if [ -f README.adoc ]; then cat README.adoc
65+
elif [ -f README.md ]; then cat README.md
66+
else printf '\n# %s\n\nDocumentation coming soon.\n' "$(basename "$PWD")"
67+
fi
68+
} > site/index.md
3769
fi
38-
./.ddraig-ssg/build/exec/ddraig build src _site https://hyperpolymath.github.io/${GITHUB_REPOSITORY#*/}
70+
cd .casket-ssg && cabal run casket-ssg -- build ../site ../_site
71+
72+
- name: Setup Pages
73+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
74+
3975
- name: Upload artifact
40-
uses: actions/upload-pages-artifact@v3
76+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v3
4177
with:
4278
path: '_site'
79+
4380
deploy:
81+
timeout-minutes: 20
4482
environment:
4583
name: github-pages
4684
url: ${{ steps.deployment.outputs.page_url }}
4785
runs-on: ubuntu-latest
48-
timeout-minutes: 15
4986
needs: build
5087
steps:
5188
- name: Deploy to GitHub Pages
5289
id: deployment
53-
uses: actions/deploy-pages@v4
90+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

0 commit comments

Comments
 (0)