|
| 1 | +name: Docs |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - 'website/**' |
| 9 | + - '.github/workflows/docs-pages.yml' |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + paths: |
| 14 | + - 'website/**' |
| 15 | + - '.github/workflows/docs-pages.yml' |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + |
| 21 | +concurrency: |
| 22 | + group: pages-${{ github.ref }} |
| 23 | + cancel-in-progress: true |
| 24 | + |
| 25 | +jobs: |
| 26 | + build: |
| 27 | + name: Build documentation |
| 28 | + runs-on: ubuntu-latest |
| 29 | + permissions: |
| 30 | + contents: read |
| 31 | + pages: read |
| 32 | + defaults: |
| 33 | + run: |
| 34 | + working-directory: website |
| 35 | + steps: |
| 36 | + - name: Check out repository |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - name: Set up Node.js |
| 40 | + uses: actions/setup-node@v4 |
| 41 | + with: |
| 42 | + node-version: 22 |
| 43 | + cache: npm |
| 44 | + cache-dependency-path: website/package-lock.json |
| 45 | + |
| 46 | + - name: Install dependencies |
| 47 | + run: npm ci |
| 48 | + |
| 49 | + - name: Check formatting |
| 50 | + run: npm run format:check |
| 51 | + |
| 52 | + - name: Lint and check language parity |
| 53 | + run: npm run lint |
| 54 | + |
| 55 | + - name: Configure GitHub Pages |
| 56 | + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' |
| 57 | + uses: actions/configure-pages@v5 |
| 58 | + |
| 59 | + - name: Build website |
| 60 | + run: npm run build |
| 61 | + env: |
| 62 | + DOCS_BASE: /Code/ |
| 63 | + DOCS_ORIGIN: https://a3s-lab.github.io |
| 64 | + |
| 65 | + - name: Check built routes and assets |
| 66 | + run: npm run check:site |
| 67 | + |
| 68 | + - name: Upload GitHub Pages artifact |
| 69 | + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' |
| 70 | + uses: actions/upload-pages-artifact@v4 |
| 71 | + with: |
| 72 | + path: website/doc_build |
| 73 | + |
| 74 | + deploy: |
| 75 | + name: Deploy documentation |
| 76 | + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' |
| 77 | + needs: build |
| 78 | + runs-on: ubuntu-latest |
| 79 | + permissions: |
| 80 | + pages: write |
| 81 | + id-token: write |
| 82 | + environment: |
| 83 | + name: github-pages |
| 84 | + url: ${{ steps.deployment.outputs.page_url }} |
| 85 | + steps: |
| 86 | + - name: Deploy to GitHub Pages |
| 87 | + id: deployment |
| 88 | + uses: actions/deploy-pages@v4 |
0 commit comments