|
7 | 7 | required: true
|
8 | 8 | type: string
|
9 | 9 | workflow_dispatch:
|
| 10 | + inputs: |
| 11 | + docs: |
| 12 | + description: "Set to 'yes' to deploy docfx to GitHub Pages." |
| 13 | + required: false |
| 14 | + default: "no" |
10 | 15 | push:
|
| 16 | + # Deploy automatically on a new release, automatically publishes docfx to GitHub Pages |
| 17 | + release: |
| 18 | + types: [published] |
11 | 19 |
|
12 | 20 | env:
|
13 | 21 | DOTNET_NOLOGO: true
|
|
19 | 27 | runs-on: ubuntu-22.04
|
20 | 28 | permissions:
|
21 | 29 | contents: read
|
| 30 | + |
| 31 | + # Expose the docs version as a job-level output |
| 32 | + outputs: |
| 33 | + doc_version: ${{ steps.nbgv.outputs.AssemblyInformationalVersion }} |
| 34 | + |
22 | 35 | steps:
|
23 | 36 | - uses: actions/checkout@v4
|
24 | 37 | with:
|
|
65 | 78 | with:
|
66 | 79 | name: FastBertTokenizer-nupkg-${{ steps.nbgv.outputs.AssemblyInformationalVersion }}
|
67 | 80 | path: bin/Packages/Release/**/*
|
| 81 | + |
| 82 | + ######################################################################### |
| 83 | + # DEPLOY Docs Job (runs only if release event OR if "docs: yes" manually) |
| 84 | + ######################################################################### |
| 85 | + deploy-docs: |
| 86 | + name: Deploy docfx to GitHub Pages |
| 87 | + runs-on: ubuntu-22.04 |
| 88 | + needs: build |
| 89 | + |
| 90 | + # Condition: |
| 91 | + # 1) if it's a RELEASE event, OR |
| 92 | + # 2) if it's a manual dispatch with docs == 'yes' |
| 93 | + # Otherwise, skip |
| 94 | + if: > |
| 95 | + ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.docs == 'yes') }} |
| 96 | +
|
| 97 | + # Pages deployment requires these permissions |
| 98 | + permissions: |
| 99 | + contents: read |
| 100 | + pages: write |
| 101 | + id-token: write |
| 102 | + |
| 103 | + steps: |
| 104 | + - name: Download docs artifact |
| 105 | + uses: actions/download-artifact@v4 |
| 106 | + with: |
| 107 | + name: FastBertTokenizer-docs-${{ needs.build.outputs.doc_version }} |
| 108 | + path: docs |
| 109 | + |
| 110 | + - name: Configure Pages |
| 111 | + uses: actions/configure-pages@v5 |
| 112 | + |
| 113 | + - name: Upload pages artifact |
| 114 | + uses: actions/upload-pages-artifact@v3 |
| 115 | + with: |
| 116 | + path: docs |
| 117 | + |
| 118 | + - name: Deploy to GitHub Pages |
| 119 | + id: deployment |
| 120 | + uses: actions/deploy-pages@v4 |
0 commit comments