-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 1.53 KB
/
haddock.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Haddock
on:
push:
branches: [master]
paths:
- '**.cabal'
- '**.hs'
jobs:
haddock:
name: haddock / ${{ matrix.ghc }}
runs-on: ubuntu-latest
strategy:
matrix:
cabal: ["3.2"]
ghc: ["8.10.1"]
steps:
- uses: actions/checkout@v2
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
- uses: actions/[email protected]
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- uses: actions/cache@v1
name: Cache cabal-store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal
- name: Build
run: |
cabal update
mkdir -p docs
find docs -mindepth 1 -delete
haddock_index=$(cabal v2-haddock --enable-documentation --haddock-hyperlink-source --haddock-quickjump --haddock-html-location='https://hackage.haskell.org/package/$pkg-$version/docs' | tail -1)
haddock_dir=$(dirname $haddock_index)
cp -R $haddock_dir/* docs
- name: Commit
run: |
cd docs
git add .
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "CI: Update documentation" | exit 0
- name: Push
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}