Skip to content

Build and deploy

Build and deploy #229

Workflow file for this run

name: Build and deploy
on:
push:
branches: [main]
workflow_dispatch:
schedule:
- cron: '0 6 * * *'
permissions:
contents: write
issues: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
- name: Run tests
run: uv run --group test pytest
- name: Bootstrap projects
run: uv run bootstrap.py
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_USERNAME: ${{ vars.GH_USERNAME }}
- name: Build site
run: uv run build.py
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GH_USERNAME: ${{ vars.GH_USERNAME }}
CACHE_TTL_HOURS: "0"
CUSTOM_DOMAIN: ${{ vars.CUSTOM_DOMAIN }}
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./output
cname: ${{ vars.CUSTOM_DOMAIN }}
- name: Open issue on failure
if: failure()
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
open=$(gh issue list --state open --search 'in:title "Build failing"' --json number --jq length)
if [ "$open" = 0 ]; then
gh issue create --title "Build failing" --body "The build failed: $RUN_URL. If bootstrap returned 401, renew the GH_TOKEN secret."
else
echo "Issue already open; skipping."
fi