-
Notifications
You must be signed in to change notification settings - Fork 6
79 lines (65 loc) · 2.22 KB
/
generate-website.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: generate-website
on:
push:
branches: [master]
pull_request:
schedule:
- cron: 10 14 * * * # 10 minutes after 101 slot starts (UTC timezone)
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
DEPLOY: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
steps:
##### Setup ##############################################
- name: Checkout repository
uses: actions/checkout@v3
- name: Detect if we should rebuild the binaries
uses: dorny/paths-filter@v2
id: changes
if: github.event_name != 'schedule'
with:
filters: |
haskell-changed:
- '*.hs'
- name: Install cabal and GHC
if: github.event_name != 'schedule' && steps.changes.outputs.haskell-changed == 'true'
uses: haskell/actions/setup@v2
with:
ghc-version: 'latest'
cabal-version: 'latest'
- name: Cache cabal and executables
uses: actions/cache@v3
with:
path: |
~/.cabal/store
~/_dist
~/.cabal/bin/
key: cabal-${{ runner.os }}
##### Installation #######################################
- name: Install Generate[101]
if: github.event_name != 'schedule' && steps.changes.outputs.haskell-changed == 'true'
run: cabal install --overwrite-policy=always --builddir _dist
- name: Add .cabal/bin to PATH
run: echo ~/.cabal/bin >> $GITHUB_PATH
##### Generation #########################################
- name: Generate 101
run: Generate101
- name: Generate website
run: Generate
##### Deployment #########################################
- name: Deploy to branch
if: ${{ env.DEPLOY }}
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: build
FOLDER: _build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger pull at website
if: ${{ env.DEPLOY }}
shell: bash
env:
PASSPHRASE: ${{ secrets.WEBHOOK_PASSPHRASE }}
run: |
curl -X POST -d "secret=$PASSPHRASE" https://msp.cis.strath.ac.uk/webhook.php