Netlify is not notified of pushes to this repository, so the workflow asks it to build: a third job calls a Netlify build hook once the validator and the site's tests and build have passed on main. A failing record or page is therefore never published. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
name: Validate
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- run: python3 tools/validate.py
|
|
|
|
site:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
# Standard library only: no packages to install, and no ImageMagick.
|
|
# web/tools/make_thumbs.py is a manual tool; web/thumbs/ is committed
|
|
# and the build only copies those thumbnails (see web/olt/thumbs.py).
|
|
- run: python3 -m unittest discover -s web/tests
|
|
- run: python3 web/build.py --out _site
|
|
|
|
# Netlify builds the site from this repository when asked to. Asking only
|
|
# after both jobs above pass means a broken record or page is never deployed.
|
|
deploy:
|
|
needs: [validate, site]
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'swaits/longhikes'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Ask Netlify to build and publish main
|
|
env:
|
|
NETLIFY_BUILD_HOOK: ${{ secrets.NETLIFY_BUILD_HOOK }}
|
|
run: curl -fsS -X POST -d '{}' "$NETLIFY_BUILD_HOOK"
|