Upgrade to Python 3.12 #72
This file contains hidden or 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: Docs | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: write # needed for committing changes | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # needed for checking changes and pushing | |
submodules: recursive | |
- name: Set up Python | |
if: github.event_name == 'push' | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Poetry | |
if: github.event_name == 'push' | |
run: pipx install poetry | |
- name: Install changelog dependencies | |
if: github.event_name == 'push' | |
working-directory: ./changelog | |
run: poetry install --no-root | |
- name: Generate changelog MDX and sidebar | |
if: github.event_name == 'push' | |
working-directory: ./changelog | |
run: | | |
poetry run ./changelog.py \ | |
--output-dir ../src/content/docs/changelog/ \ | |
--sidebar-file ../src/sidebar-changelog.ts | |
- name: Commit and push changes | |
if: github.event_name == 'push' | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add src/content/docs/changelog/ src/sidebar-changelog.ts | |
if ! git diff --cached --quiet; then | |
git commit -m "Update changelog [skip ci]" | |
git push origin main | |
echo "✅ Changes committed and pushed" | |
else | |
echo "ℹ️ No effective changes to commit after git add" | |
fi | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Setup Node.js and pnpm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Setup GitHub Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
- name: Build with Astro | |
run: | | |
# TODO: enable before going live. | |
#env: | |
# RUN_LINK_CHECK: true | |
pnpm astro build \ | |
--site "${{ steps.pages.outputs.origin }}" \ | |
--base "${{ steps.pages.outputs.base_path }}" | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./dist | |
deploy: | |
name: Deploy | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |