-
Notifications
You must be signed in to change notification settings - Fork 6
85 lines (69 loc) · 2.41 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
80
81
82
83
84
85
name: generate-website
on:
push:
branches: [master]
pull_request:
schedule:
- cron: 10 14 * * * # 10 minutes after 101 slot starts (UTC timezone)
env:
GHC_VERSION: 9.6
jobs:
build-and-deploy:
runs-on: ubuntu-latest
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'
- '.github/workflows/generate-website.yml'
- name: Install cabal and GHC
if: github.event_name != 'schedule' && steps.changes.outputs.haskell-changed == 'true'
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ env.GHC_VERSION }}
cabal-version: 'latest'
- name: Cache cabal and executables
uses: actions/cache@v3
with:
path: |
~/.cabal/store
~/_dist
~/.cabal/bin/
key: cabal-${{ runner.os }}-${{ env.GHC_VERSION }}-${{ github.sha }}
restore-keys: cabal-${{ runner.os }}-${{ env.GHC_VERSION }}
##### 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 News
run: GenerateNews
- name: Generate website
run: Generate
##### Deployment #########################################
- name: Deploy to branch
if: github.ref == 'refs/heads/master'
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: github.ref == 'refs/heads/master'
shell: bash
env:
PASSPHRASE: ${{ secrets.WEBHOOK_PASSPHRASE }}
run: |
curl -X POST -d "secret=$PASSPHRASE" https://msp.cis.strath.ac.uk/webhook.php