Static site build #457
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: Static site build | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: ['Fetch data'] | |
types: [completed] | |
jobs: | |
exit: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | |
steps: | |
- name: Exit on fetch failure | |
run: | | |
gh run cancel ${{ github.run_id }} | |
gh run watch ${{ github.run_id }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} || ${{ github.event_name == 'workflow_dispatch' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Get build date | |
id: date-get | |
run: | | |
echo "BUILD_DATE=$(TZ=America/New_York date +%Y-%m-%d)" >> $GITHUB_ENV | |
- name: Print build date | |
id: date-print | |
run: | | |
echo ${{ env.BUILD_DATE }} >> .last-updated | |
- name: Build | |
run: | | |
npm ci | |
npm run build | |
touch dist/.nojekyll | |
echo "216.show" >> dist/CNAME | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@v4.4.3 | |
with: | |
branch: gh-pages | |
folder: dist |