Skip to content

Upgrade artifact and Pages actions safely #6

Upgrade artifact and Pages actions safely

Upgrade artifact and Pages actions safely #6

Workflow file for this run

name: GitHub Pages
on:
pull_request:
paths:
- ".github/workflows/pages.yml"
- "assets/social-preview.jpg"
- "data/italian_locations.csv"
- "scripts/build_pages.py"
- "site/**"
- "tests/pages_core.test.mjs"
- "tests/test_pages.py"
push:
branches:
- main
paths:
- ".github/workflows/pages.yml"
- "assets/social-preview.jpg"
- "data/italian_locations.csv"
- "scripts/build_pages.py"
- "site/**"
- "tests/pages_core.test.mjs"
- "tests/test_pages.py"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: >-
github-pages-${{
github.event_name == 'pull_request' &&
github.event.pull_request.number ||
'deploy'
}}
cancel-in-progress: true
jobs:
build:
name: Build and test site
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Test search and map logic
run: node --test tests/pages_core.test.mjs
- name: Test deterministic Pages build
run: python -m unittest discover -s tests -p "test_pages.py" -v
- name: Build GitHub Pages artifact
run: python scripts/build_pages.py --output _site
- name: Configure GitHub Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: _site
deploy:
name: Deploy site
if: github.event_name != 'pull_request'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
timeout-minutes: 10
steps:
- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4