|
| 1 | +# Based on https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml |
| 2 | +name: Build typedoc docs site, Deploy to Pages when on default branch |
| 3 | + |
| 4 | +env: |
| 5 | + DOCS_DIR: docs |
| 6 | + |
| 7 | +on: |
| 8 | + # Run workflow on any branch push. |
| 9 | + # Conditionals are used to only trigger deploy on the default branch. |
| 10 | + push: |
| 11 | + # Uncomment to only run on specific branch pushes. |
| 12 | + # branches: ["master"] |
| 13 | + |
| 14 | + # Allows you to run this workflow manually from the Actions tab |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + pages: write |
| 21 | + id-token: write |
| 22 | + |
| 23 | +# Allow only one concurrent deployment per branch, skipping runs queued between the run in-progress and latest queued. |
| 24 | +# However, do NOT cancel in-progress runs as we want to allow the deployments to complete. |
| 25 | +concurrency: |
| 26 | + group: "pages-${{ github.ref }}" |
| 27 | + cancel-in-progress: false |
| 28 | + |
| 29 | +jobs: |
| 30 | + # Build job |
| 31 | + build: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + - name: Setup Node |
| 37 | + uses: actions/setup-node@v4 |
| 38 | + with: |
| 39 | + node-version: 18 |
| 40 | + - name: Setup Pages |
| 41 | + id: pages |
| 42 | + uses: actions/configure-pages@v4 |
| 43 | + - name: Build with Typedoc |
| 44 | + run: npm i && npm run docs |
| 45 | + - name: Upload artifact |
| 46 | + if: github.ref == 'refs/heads/master' # Only upload when on default branch |
| 47 | + uses: actions/upload-pages-artifact@v3 |
| 48 | + with: |
| 49 | + path: "./${{ env.DOCS_DIR }}" |
| 50 | + |
| 51 | + # Deployment job |
| 52 | + deploy: |
| 53 | + if: github.ref == 'refs/heads/master' # Only deploy when on default branch |
| 54 | + environment: |
| 55 | + name: github-pages |
| 56 | + url: ${{ steps.deployment.outputs.page_url }} |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: build |
| 59 | + steps: |
| 60 | + - name: Deploy to GitHub Pages |
| 61 | + id: deployment |
| 62 | + uses: actions/deploy-pages@v4 |
0 commit comments