|
| 1 | +name: Docs — Build & Deploy |
| 2 | + |
| 3 | +# Builds the Docusaurus site under /website and, on push to beta, deploys |
| 4 | +# to GitHub Pages at https://coplaydev.github.io/unity-mcp/. |
| 5 | +# |
| 6 | +# PR runs only build (no deploy) as a preview-validation step. |
| 7 | +# Re-deploys also fire when the Python tool/resource registry changes, |
| 8 | +# so M3's auto-generated reference pages stay fresh. |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: [beta] |
| 13 | + paths: |
| 14 | + - website/** |
| 15 | + - docs/** |
| 16 | + - Server/src/services/tools/** |
| 17 | + - Server/src/services/resources/** |
| 18 | + - Server/src/services/registry/** |
| 19 | + - .github/workflows/docs-deploy.yml |
| 20 | + pull_request: |
| 21 | + branches: [beta, main] |
| 22 | + paths: |
| 23 | + - website/** |
| 24 | + - docs/** |
| 25 | + - Server/src/services/tools/** |
| 26 | + - Server/src/services/resources/** |
| 27 | + - Server/src/services/registry/** |
| 28 | + - .github/workflows/docs-deploy.yml |
| 29 | + workflow_dispatch: {} |
| 30 | + |
| 31 | +permissions: |
| 32 | + contents: read |
| 33 | + pages: write |
| 34 | + id-token: write |
| 35 | + |
| 36 | +concurrency: |
| 37 | + group: pages |
| 38 | + cancel-in-progress: false |
| 39 | + |
| 40 | +jobs: |
| 41 | + build: |
| 42 | + name: Build site |
| 43 | + runs-on: ubuntu-latest |
| 44 | + steps: |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + # Full history so Docusaurus's showLastUpdateTime / showLastUpdateAuthor |
| 49 | + # can resolve real per-file commit metadata. Shallow clones make every |
| 50 | + # page report the latest commit instead. |
| 51 | + fetch-depth: 0 |
| 52 | + # No push back from this workflow — the deploy uses the Pages |
| 53 | + # OIDC token issued by actions/deploy-pages, not the repo token. |
| 54 | + persist-credentials: false |
| 55 | + |
| 56 | + - name: Setup Node |
| 57 | + uses: actions/setup-node@v4 |
| 58 | + with: |
| 59 | + node-version: 20 |
| 60 | + cache: npm |
| 61 | + cache-dependency-path: website/package-lock.json |
| 62 | + |
| 63 | + - name: Install dependencies |
| 64 | + working-directory: website |
| 65 | + run: npm ci |
| 66 | + |
| 67 | + - name: Setup Pages |
| 68 | + if: github.event_name == 'push' && github.ref == 'refs/heads/beta' |
| 69 | + uses: actions/configure-pages@v5 |
| 70 | + |
| 71 | + - name: Build |
| 72 | + working-directory: website |
| 73 | + run: npm run build |
| 74 | + |
| 75 | + - name: Upload Pages artifact |
| 76 | + if: github.event_name == 'push' && github.ref == 'refs/heads/beta' |
| 77 | + uses: actions/upload-pages-artifact@v3 |
| 78 | + with: |
| 79 | + path: website/build |
| 80 | + |
| 81 | + deploy: |
| 82 | + name: Deploy to GitHub Pages |
| 83 | + needs: build |
| 84 | + if: github.event_name == 'push' && github.ref == 'refs/heads/beta' |
| 85 | + runs-on: ubuntu-latest |
| 86 | + environment: |
| 87 | + name: github-pages |
| 88 | + url: ${{ steps.deployment.outputs.page_url }} |
| 89 | + steps: |
| 90 | + - name: Deploy |
| 91 | + id: deployment |
| 92 | + uses: actions/deploy-pages@v4 |
0 commit comments