Haddock to GitHub pages #29
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: Haddock to GitHub pages | |
on: | |
workflow_run: | |
workflows: ["Haskell CI (fast)"] | |
branches: [ main ] | |
types: completed | |
jobs: | |
build: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Stack | |
id: cache-stack-unix | |
uses: actions/cache@v3 | |
with: | |
path: ~/.stack | |
key: ubuntu-latest-stack-home-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }} | |
- name: Setup stack | |
uses: haskell/actions/setup@v2 | |
with: | |
enable-stack: true | |
stack-no-global: true | |
- name: Build Haddock | |
shell: bash | |
run: | | |
shopt -s globstar && \ | |
stack exec haddock -- ./src/**/*.hs \ | |
$(for m in src/**/Internal/*.hs; do echo -n " --hide $m" | sed -r -e 's|/|.|g' -e 's|.src.||' -e 's|.hs||'; done) \ | |
--html --pretty-html --hyperlinked-source --quickjump \ | |
--title="IOTasks" \ | |
--prologue=haddock/prologue \ | |
--odir docs | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
name: github-pages | |
path: docs | |
retention-days: 1 | |
deploy: | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} |