Skip to content

Deploy pages to GitHub Pages #328

Deploy pages to GitHub Pages

Deploy pages to GitHub Pages #328

Workflow file for this run

name: Deploy pages to GitHub Pages
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Run daily at 2:43 AM to refresh the latest release metadata and ensure pages are up-to-date.
- cron: '43 2 * * *'
workflow_dispatch:
defaults:
run:
shell: bash
env:
BUILD_PATH: "pages"
permissions:
contents: read
pages: write
id-token: write
jobs:
BuildPages:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: 22
cache: npm
cache-dependency-path: ${{ env.BUILD_PATH }}/package-lock.json
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Install dependencies
run: npm ci
working-directory: ${{ env.BUILD_PATH }}
- name: Build pages
run: |
npx astro build \
--site "${{ steps.pages.outputs.origin }}" \
--base "${{ steps.pages.outputs.base_path }}"
working-directory: ${{ env.BUILD_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: ${{ env.BUILD_PATH }}/dist
DeployPages:
runs-on: "ubuntu-24.04"
needs: [BuildPages]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4