Files
blockly/.github/workflows/deploy-docusaurus.yml
T
2026-03-31 14:38:05 +01:00

70 lines
2.1 KiB
YAML

# .github/workflows/deploy-docusaurus.yml
# This workflow deploys the Blockly documentation to GitHub Pages.
# Run this manually after a release to publish updated documentation.
name: Deploy Docusaurus to GitHub Pages
on:
# To run: GitHub -> Actions -> "Deploy Docusaurus to GitHub Pages" -> Run workflow
# Optionally set `ref` to the release branch/tag
workflow_dispatch:
inputs:
ref:
description: 'Branch, tag, or commit SHA to deploy (defaults to main)'
required: false
default: 'main'
type: string
# Sets the permissions for the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued
# However, do not cancel in-progress runs as we want to allow these production deployments to complete
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout your repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || 'main' }}
# Allow Docusaurus to view the full commit history (required for "last edited at <date> by <person>" functionality)
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
cache-dependency-path: packages/docs/package-lock.json
- name: Install dependencies
working-directory: ./packages/docs
run: npm ci
- name: Build the Docusaurus site
working-directory: ./packages/docs
run: npm run build
- name: Setup GitHub Pages
uses: actions/configure-pages@v5
- name: Upload build artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./packages/docs/build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4