Skip to content

Deploy to GitHub Pages #165

Deploy to GitHub Pages

Deploy to GitHub Pages #165

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: [main]
schedule:
# Daily redeploy at 06:00 UTC so popular notebooks data stays fresh
# without a separate workflow opening pull requests.
- cron: "0 6 * * *"
workflow_dispatch:
permissions:
contents: write
id-token: write # Required for Azure OIDC federated credential
concurrency:
group: "gh-pages-deploy"
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: |
site/package-lock.json
scripts/package-lock.json
- name: Install site dependencies
working-directory: ./site
run: npm ci
- name: Install script dependencies
working-directory: ./scripts
run: npm ci
- name: Azure login (OIDC)
uses: azure/login@v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Refresh popular notebooks data from App Insights
id: refresh-popular
continue-on-error: true
working-directory: ./scripts
env:
APP_INSIGHTS_RESOURCE_ID: ${{ vars.APP_INSIGHTS_RESOURCE_ID }}
run: npx tsx fetch-popular.ts
- name: Warn if popular data refresh failed
if: steps.refresh-popular.outcome == 'failure'
run: echo "::warning::App Insights refresh failed — building with the committed site/src/data/popular.json fallback."
- name: Build site
working-directory: ./site
env:
PUBLIC_APP_INSIGHTS_CONNECTION_STRING: ${{ vars.PUBLIC_APP_INSIGHTS_CONNECTION_STRING }}
run: npm run build
- name: Install Playwright browser
working-directory: ./site
run: npx playwright install --with-deps chromium
- name: Run accessibility checks
working-directory: ./site
run: npm run test:a11y
- name: Add .nojekyll
run: touch ./site/dist/.nojekyll
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: ./site/dist
clean: true
clean-exclude: preview