|
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 | | - |
| 1 | +name: GitHub Pages (Ddraig SSG) |
6 | 2 | on: |
7 | 3 | push: |
8 | | - branches: [main] |
| 4 | + branches: [main, master] |
9 | 5 | workflow_dispatch: |
10 | | - |
11 | 6 | permissions: |
12 | 7 | contents: read |
13 | 8 | pages: write |
14 | 9 | id-token: write |
15 | | - |
16 | | -# Serialise Pages deploys; never cancel an in-flight deploy. |
17 | 10 | concurrency: |
18 | 11 | group: "pages" |
19 | 12 | cancel-in-progress: false |
20 | | - |
21 | 13 | jobs: |
22 | 14 | build: |
23 | | - timeout-minutes: 20 |
24 | 15 | runs-on: ubuntu-latest |
| 16 | + timeout-minutes: 15 |
| 17 | + container: |
| 18 | + image: ghcr.io/stefan-hoeck/idris2-pack@sha256:f0758996a931fb35d9ecb1de273c4d59dabe2a09b433afc7e357f65a08b7e1ff |
25 | 19 | steps: |
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 |
| 20 | + - name: Checkout Site |
| 21 | + uses: actions/checkout@v4 |
| 22 | + - name: Checkout Ddraig SSG |
| 23 | + uses: actions/checkout@v4 |
31 | 24 | with: |
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@2c8a9bd7457de244a408f35966fab2fb45fda9c8 # 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 | | - |
| 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 |
54 | 30 | - name: Build site |
55 | 31 | run: | |
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 |
| 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 |
69 | 37 | fi |
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 | | - |
| 38 | + ./.ddraig-ssg/build/exec/ddraig build src _site https://hyperpolymath.github.io/${GITHUB_REPOSITORY#*/} |
75 | 39 | - name: Upload artifact |
76 | | - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v3 |
| 40 | + uses: actions/upload-pages-artifact@v3 |
77 | 41 | with: |
78 | 42 | path: '_site' |
79 | | - |
80 | 43 | deploy: |
81 | | - timeout-minutes: 20 |
82 | 44 | environment: |
83 | 45 | name: github-pages |
84 | 46 | url: ${{ steps.deployment.outputs.page_url }} |
85 | 47 | runs-on: ubuntu-latest |
| 48 | + timeout-minutes: 15 |
86 | 49 | needs: build |
87 | 50 | steps: |
88 | 51 | - name: Deploy to GitHub Pages |
89 | 52 | id: deployment |
90 | | - uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |
| 53 | + uses: actions/deploy-pages@v4 |
0 commit comments