Skip to content

feat: Update site URL in astro.config.mjs and add CNAME for documenta… #15

feat: Update site URL in astro.config.mjs and add CNAME for documenta…

feat: Update site URL in astro.config.mjs and add CNAME for documenta… #15

Workflow file for this run

name: Deploy Starlight site to GitHub Pages
on:
push:
branches: ["main"]
paths:
- 'docs/**'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# 🟢 Cache npm dependencies
cache: 'npm'
cache-dependency-path: 'docs/package-lock.json'
- name: Setup Pages
uses: actions/configure-pages@v4
# 🟢 Cache node_modules (backup npm cache)
- name: Cache node_modules
uses: actions/cache@v4
with:
path: docs/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
# 🟢 Cache Astro build output
- name: Cache Astro build
uses: actions/cache@v4
with:
path: docs/.astro
key: ${{ runner.os }}-astro-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-astro-build-
# 🟢 Cache contributors data
- name: Cache Contributors Data
uses: actions/cache@v4
with:
path: docs/cache
key: ${{ runner.os }}-contributors-${{ github.repository }}-${{ github.run_number }}
restore-keys: |
${{ runner.os }}-contributors-${{ github.repository }}-
- name: Install dependencies
working-directory: docs
run: |
if [ -d "node_modules" ]; then
echo "Using cached node_modules"
npm ci --prefer-offline --no-audit
else
echo "Installing fresh dependencies"
npm ci
fi
- name: Build site
working-directory: docs
env:
# 🟢 GitHub token (rate limit 1000/hour)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4