Skip to content

chore(ci): replace per-repo governance copies with shared bundle wrapper #173

chore(ci): replace per-repo governance copies with shared bundle wrapper

chore(ci): replace per-repo governance copies with shared bundle wrapper #173

Workflow file for this run

# SPDX-License-Identifier: PMPL-1.0-or-later
name: GitHub Pages
on:
push:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
- name: Checkout casket-ssg
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
with:
repository: hyperpolymath/casket-ssg
path: .casket-ssg
- name: Setup GHCup
uses: haskell-actions/setup@cd0d9bdd65b20557f41bea4dbe43d0b5fbbfe553 # v2
with:
ghc-version: '9.8.2'
cabal-version: '3.10'
- name: Cache Cabal
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cabal/packages
~/.cabal/store
.casket-ssg/dist-newstyle
key: ${{ runner.os }}-casket-${{ hashFiles('.casket-ssg/casket-ssg.cabal') }}
- name: Build casket-ssg
working-directory: .casket-ssg
run: cabal build
- name: Prepare site source
shell: bash
run: |
set -euo pipefail
rm -rf .site-src _site
if [ -d site ]; then
cp -R site .site-src
else
mkdir -p .site-src
TODAY="$(date +%Y-%m-%d)"
REPO_NAME="${{ github.event.repository.name }}"
REPO_URL="https://github.com/${{ github.repository }}"
README_URL=""
if [ -f README.md ]; then
README_URL="${REPO_URL}/blob/${{ github.ref_name }}/README.md"
elif [ -f README.adoc ]; then
README_URL="${REPO_URL}/blob/${{ github.ref_name }}/README.adoc"
fi
{
echo "---"
echo "title: ${REPO_NAME}"
echo "date: ${TODAY}"
echo "---"
echo
echo "# ${REPO_NAME}"
echo
echo "Static documentation site for ${REPO_NAME}."
echo
echo "- Source repository: [${{ github.repository }}](${REPO_URL})"
if [ -n "${README_URL}" ]; then
echo "- README: [project README](${README_URL})"
fi
if [ -d docs ]; then
echo "- Docs directory: [docs/](${REPO_URL}/tree/${{ github.ref_name }}/docs)"
fi
echo
echo "Project-specific site content can be added later under site/."
} > .site-src/index.md
fi
- name: Build site
run: |
mkdir -p _site
cd .casket-ssg && cabal run casket-ssg -- build ../.site-src ../_site
touch ../_site/.nojekyll
- name: Setup Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- name: Upload artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: '_site'
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0