@@ -13,7 +13,7 @@ permissions:
1313
1414concurrency :
1515 group : " pages"
16- cancel-in-progress : false
16+ cancel-in-progress : true
1717
1818jobs :
1919 build :
@@ -22,79 +22,56 @@ jobs:
2222 - name : Checkout
2323 uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
2424
25- - name : Checkout casket-ssg
26- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
27- with :
28- repository : hyperpolymath/casket-ssg
29- path : .casket-ssg
30-
31- - name : Setup GHCup
32- uses : haskell-actions/setup@ec49483bfc012387b227434aba94f59a6ecd0900 # v2
33- with :
34- ghc-version : ' 9.8.2'
35- cabal-version : ' 3.10'
36-
37- - name : Cache Cabal
38- uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
39- with :
40- path : |
41- ~/.cabal/packages
42- ~/.cabal/store
43- .casket-ssg/dist-newstyle
44- key : ${{ runner.os }}-casket-${{ hashFiles('.casket-ssg/casket-ssg.cabal') }}
45-
46- - name : Build casket-ssg
47- working-directory : .casket-ssg
48- run : cabal build
49-
50- - name : Prepare site source
25+ - name : Build static site
5126 shell : bash
5227 run : |
5328 set -euo pipefail
54- rm -rf .site-src _site
29+ rm -rf _site
30+ mkdir -p _site
5531
56- if [ -d site ]; then
57- cp -R site .site-src
58- else
59- mkdir -p .site-src
60- TODAY="$(date +%Y-%m-%d)"
61- REPO_NAME="${{ github.event.repository.name }}"
62- REPO_URL="https://github.com/${{ github.repository }}"
63- README_URL=""
32+ today="$(date +%Y-%m-%d)"
33+ repo_name="${{ github.event.repository.name }}"
34+ repo_url="https://github.com/${{ github.repository }}"
35+ readme_link=""
6436
65- if [ -f README.md ]; then
66- README_URL= "${REPO_URL }/blob/${{ github.ref_name }}/README.md"
67- elif [ -f README.adoc ]; then
68- README_URL= "${REPO_URL }/blob/${{ github.ref_name }}/README.adoc"
69- fi
37+ if [ -f README.md ]; then
38+ readme_link="<li><a href=\ "${repo_url }/blob/${{ github.ref_name }}/README.md\">README</a></li> "
39+ elif [ -f README.adoc ]; then
40+ readme_link="<li><a href=\ "${repo_url }/blob/${{ github.ref_name }}/README.adoc\">README</a></li> "
41+ fi
7042
71- {
72- echo "---"
73- echo "title: ${REPO_NAME}"
74- echo "date: ${TODAY}"
75- echo "---"
76- echo
77- echo "# ${REPO_NAME}"
78- echo
79- echo "Static documentation site for ${REPO_NAME}."
80- echo
81- echo "- Source repository: [${{ github.repository }}](${REPO_URL})"
82- if [ -n "${README_URL}" ]; then
83- echo "- README: [project README](${README_URL})"
84- fi
85- if [ -d docs ]; then
86- echo "- Docs directory: [docs/](${REPO_URL}/tree/${{ github.ref_name }}/docs)"
87- fi
88- echo
89- echo "Project-specific site content can be added later under site/."
90- } > .site-src/index.md
43+ docs_link=""
44+ if [ -d docs ]; then
45+ docs_link="<li><a href=\"${repo_url}/tree/${{ github.ref_name }}/docs\">docs/</a></li>"
9146 fi
9247
93- - name : Build site
94- run : |
95- mkdir -p _site
96- cd .casket-ssg && cabal run casket-ssg -- build ../.site-src ../_site
97- touch ../_site/.nojekyll
48+ cat > _site/index.html <<EOF
49+ <!doctype html>
50+ <html lang="en">
51+ <head>
52+ <meta charset="utf-8">
53+ <meta name="viewport" content="width=device-width, initial-scale=1">
54+ <title>${repo_name}</title>
55+ <style>
56+ body { font-family: system-ui, sans-serif; max-width: 48rem; margin: 4rem auto; padding: 0 1rem; line-height: 1.5; color: #1f2937; }
57+ a { color: #0f766e; }
58+ code { background: #f3f4f6; padding: 0.15rem 0.3rem; border-radius: 0.25rem; }
59+ </style>
60+ </head>
61+ <body>
62+ <h1>${repo_name}</h1>
63+ <p>Static documentation site for <code>${{ github.repository }}</code>.</p>
64+ <ul>
65+ <li><a href="${repo_url}">Source repository</a></li>
66+ ${readme_link}
67+ ${docs_link}
68+ </ul>
69+ <p>Generated on ${today} from <code>${{ github.sha }}</code>.</p>
70+ </body>
71+ </html>
72+ EOF
73+
74+ touch _site/.nojekyll
9875
9976 - name : Setup Pages
10077 uses : actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
0 commit comments