generate-website #797
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: generate-website | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
schedule: | |
- cron: 10 13 * * * # 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@v4 | |
- name: Detect if we should rebuild the binaries | |
uses: dorny/paths-filter@v3 | |
id: changes | |
if: github.event_name != 'schedule' | |
with: | |
filters: | | |
haskell-changed: | |
- '*.cabal' | |
- '*.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@v4 | |
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 }} | |
SQUASH_HISTORY: true | |
MESSAGE: | | |
[ DEPLOY ] Website deployed at {sha} | |
The latest commit message was: | |
{msg} | |
- 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 |