microsoft/hve-core
Publicmirrored fromhttps://github.com/microsoft/hve-coreAvailable
.github/workflows/deploy-docs.yml
82lines · modecode
| 1 | # Docusaurus documentation site deployment |
| 2 | # Prerequisite: Enable GitHub Pages in repo Settings → Pages → Source: GitHub Actions |
| 3 | # and allow the target branch in Settings → Environments → github-pages → Deployment branches |
| 4 | |
| 5 | name: Deploy Documentation Site |
| 6 | |
| 7 | on: |
| 8 | push: |
| 9 | branches: |
| 10 | - main |
| 11 | paths: |
| 12 | - 'docs/**' |
| 13 | - '.github/workflows/deploy-docs.yml' |
| 14 | workflow_dispatch: |
| 15 | |
| 16 | concurrency: |
| 17 | group: pages-deploy-${{ github.ref }} |
| 18 | cancel-in-progress: false |
| 19 | |
| 20 | permissions: |
| 21 | contents: read |
| 22 | |
| 23 | jobs: |
| 24 | test: |
| 25 | name: Docusaurus Tests |
| 26 | uses: ./.github/workflows/docusaurus-tests.yml |
| 27 | permissions: |
| 28 | contents: read |
| 29 | with: |
| 30 | soft-fail: false |
| 31 | |
| 32 | build: |
| 33 | name: Build Docusaurus |
| 34 | needs: test |
| 35 | runs-on: ubuntu-latest |
| 36 | permissions: |
| 37 | contents: read |
| 38 | pages: write |
| 39 | steps: |
| 40 | - name: Checkout |
| 41 | uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2 |
| 42 | with: |
| 43 | persist-credentials: false |
| 44 | fetch-depth: 0 |
| 45 | |
| 46 | - name: Setup Node.js |
| 47 | uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 |
| 48 | with: |
| 49 | node-version: 20 |
| 50 | cache: npm |
| 51 | cache-dependency-path: docs/docusaurus/package-lock.json |
| 52 | |
| 53 | - name: Install dependencies |
| 54 | working-directory: docs/docusaurus |
| 55 | run: npm ci |
| 56 | |
| 57 | - name: Build site |
| 58 | working-directory: docs/docusaurus |
| 59 | run: npm run build |
| 60 | |
| 61 | - name: Configure Pages |
| 62 | uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 |
| 63 | |
| 64 | - name: Upload artifact |
| 65 | uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 |
| 66 | with: |
| 67 | path: docs/docusaurus/build |
| 68 | |
| 69 | deploy: |
| 70 | name: Deploy to GitHub Pages |
| 71 | needs: build |
| 72 | runs-on: ubuntu-latest |
| 73 | permissions: |
| 74 | pages: write |
| 75 | id-token: write |
| 76 | environment: |
| 77 | name: github-pages |
| 78 | url: ${{ steps.deployment.outputs.page_url }} |
| 79 | steps: |
| 80 | - name: Deploy to GitHub Pages |
| 81 | id: deployment |
| 82 | uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |
| 83 | |