Skip to content

Reflection

Reflection #13

Workflow file for this run

name: Deploy Astro site to Pages
on:
push:
branches: ["main"] # run on every push to main
workflow_dispatch: # allow manual runs
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
env:
BUILD_PATH: "." # change only if your Astro project lives in a sub‑folder
jobs:
build:
runs-on: ubuntu-latest
steps:
# 1 · Check out your code
- uses: actions/checkout@v4
# 2 · Set up Node 20 (no cache => no pnpm‑lookup error)
- uses: actions/setup-node@v4
with:
node-version: 20
# 3 · Install pnpm (and put it on PATH)
- uses: pnpm/action-setup@v3
with:
version: latest # or "latest"
run_install: false # we’ll install ourselves in the next step
# 4 · Install dependencies
- run: pnpm install --frozen-lockfile
working-directory: ${{ env.BUILD_PATH }}
# 5 · Configure GitHub Pages (sets the correct URLs for Astro)
- id: pages
uses: actions/configure-pages@v5
# 6 · Build the Astro site
- run: pnpm astro build \
--site "${{ steps.pages.outputs.origin }}" \
--base "${{ steps.pages.outputs.base_path }}"
working-directory: ${{ env.BUILD_PATH }}
# 7 · Upload the generated files (dist/) as an artifact
- uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.BUILD_PATH }}/dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# 8 · Deploy to GitHub Pages
- id: deployment
uses: actions/deploy-pages@v4