|
| 1 | +# .github/workflows/deploy-docusaurus.yml |
| 2 | +# This workflow deploys the Blockly documentation to GitHub Pages. |
| 3 | +# Run this manually after a release to publish updated documentation. |
| 4 | + |
| 5 | +name: Deploy Docusaurus to GitHub Pages |
| 6 | + |
| 7 | +on: |
| 8 | + # To run: GitHub -> Actions -> "Deploy Docusaurus to GitHub Pages" -> Run workflow |
| 9 | + # Optionally set `ref` to the release branch/tag; leave default to deploy `main` |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + ref: |
| 13 | + description: 'Branch, tag, or commit SHA to deploy (defaults to main)' |
| 14 | + required: false |
| 15 | + default: 'main' |
| 16 | + type: string |
| 17 | + |
| 18 | +# Sets the permissions for the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + pages: write |
| 22 | + id-token: write |
| 23 | + |
| 24 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued |
| 25 | +# However, do not cancel in-progress runs as we want to allow these production deployments to complete |
| 26 | +concurrency: |
| 27 | + group: "pages" |
| 28 | + cancel-in-progress: false |
| 29 | + |
| 30 | +jobs: |
| 31 | + deploy: |
| 32 | + environment: |
| 33 | + name: github-pages |
| 34 | + url: ${{ steps.deployment.outputs.page_url }} |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - name: Checkout your repository |
| 38 | + uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + ref: ${{ inputs.ref || 'main' }} |
| 41 | + # Allow Docusaurus to view the full commit history (required for "last edited at <date> by <person>" functionality) |
| 42 | + fetch-depth: 0 |
| 43 | + |
| 44 | + - name: Set up Node.js |
| 45 | + uses: actions/setup-node@v4 |
| 46 | + with: |
| 47 | + node-version: 20.x |
| 48 | + cache: 'npm' |
| 49 | + cache-dependency-path: packages/docs/package-lock.json |
| 50 | + |
| 51 | + - name: Install dependencies |
| 52 | + working-directory: ./packages/docs |
| 53 | + run: npm ci |
| 54 | + |
| 55 | + - name: Build the Docusaurus site |
| 56 | + working-directory: ./packages/docs |
| 57 | + run: npm run build |
| 58 | + |
| 59 | + - name: Setup GitHub Pages |
| 60 | + uses: actions/configure-pages@v5 |
| 61 | + |
| 62 | + - name: Upload build artifact |
| 63 | + uses: actions/upload-pages-artifact@v3 |
| 64 | + with: |
| 65 | + path: ./packages/docs/build |
| 66 | + |
| 67 | + - name: Deploy to GitHub Pages |
| 68 | + id: deployment |
| 69 | + uses: actions/deploy-pages@v4 |
0 commit comments