Builds Static website & hosts on https://qcr.github.io #1489
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: 'Builds Static website & hosts on https://qcr.github.io' | |
on: | |
schedule: | |
- cron: '0 14 * * *' # run at ~midnight AEST | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout site code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '16' | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
env: | |
cache-name: node | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.cache-name }}- | |
- name: Install dependencies | |
run: | | |
sudo apt update && sudo apt install -y ffmpeg | |
npm install | |
- name: Build | |
run: | | |
npm run build && npm run export | |
- name: Push result to gh_pages branch | |
run: | | |
cp -r out/ ../ | |
git fetch --all | |
git checkout -f gh_pages | |
git reset --hard build_root | |
git clean -d -x -f | |
cp -r ../out/* . | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Generated from contents of master commit: $(git rev-parse --short "$GITHUB_SHA")" | |
git push -f |