Skip to content

Merge pull request #6 from shumbo/location-template #33

Merge pull request #6 from shumbo/location-template

Merge pull request #6 from shumbo/location-template #33

Workflow file for this run

name: Build and deploy documentation
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
paths: 'src/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# heavily inspired by https://github.com/haskell/actions/tree/main/setup
build-deploy-doc:
name: Build and deploy Haddock
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up GHC 9.2.8 and Cabal 3.6.2.0
uses: haskell/actions/setup@v2
id: setup
with:
ghc-version: '9.2.8'
cabal-version: '3.6.2.0'
cabal-update: true
- name: Configure the build
run: |
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.
- name: Restore cached dependencies
uses: actions/cache/restore@v3
id: cache
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-
- name: Install dependencies
run: cabal build all --only-dependencies
# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
- name: Save cached dependencies
uses: actions/cache/save@v3
# Caches are immutable, trying to save with the same key would error.
if: ${{ steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}
- name: Build doc
run: cabal haddock --haddock-hyperlink-source --haddock-quickjump --haddock-html-location='https://hackage.haskell.org/package/$pkg-$version/docs'
- name: Setup GitHub Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# FIXME: make cabal output where the generated doc is instaed of hard coding it
path: './dist-newstyle/build/x86_64-linux/ghc-9.2.8/HasChor-0.1.0.0/doc/html/HasChor/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2