CI: build and publish documentation #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Documentation | |
on: | |
push: | |
branches: [master] | |
jobs: | |
build-and-deploy: | |
if: contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cabal/ghc | |
uses: haskell-actions/setup@v2 | |
id: setup-haskell | |
with: | |
ghc-version: '9.6.3' | |
cabal-version: '3.10.2.0' | |
- name: Set PATH for cabal-installed executables | |
run: | | |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH | |
- name: Set Cabal options | |
# Overwriting prevent cabal from raising an error when installing | |
# an executable that is already present (because of caching) | |
# Some of these options are superfluous for this workflow, | |
# but I'm keeping them in sync with ci.yml so that caching is | |
# shared | |
run: | | |
cabal update | |
cabal user-config update -f -a "overwrite-policy: always" | |
cabal user-config update -f -a "install-method: copy" | |
cabal user-config update -f -a "split-sections: True" | |
cabal user-config update -f -a "executable-stripping: True" | |
- name: Cache cabal work | |
uses: actions/cache@v3 | |
with: | |
path: | | |
dist-newstyle | |
${{ steps.setup-haskell.outputs.cabal-store }} | |
key: ${{ runner.os }}-${{ hashFiles('cabal.*') }}-cabal-install | |
- name: Build site compiler | |
run: | | |
htmlloc=$(cabal haddock -j --disable-optimization | tail -n 1) | |
mkdir html-doc | |
cp htmlloc html-doc | |
- name: Deploy | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: html-doc | |
clean: true |