|
| 1 | +name: Website |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - '.github/workflows/website.yml' |
| 9 | + - 'website/**' |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + pages: write |
| 16 | + id-token: write |
| 17 | + |
| 18 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 19 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 20 | +concurrency: |
| 21 | + group: pages |
| 22 | + cancel-in-progress: false |
| 23 | + |
| 24 | +jobs: |
| 25 | + # Build job |
| 26 | + build: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + defaults: |
| 29 | + run: |
| 30 | + working-directory: ./website |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + fetch-depth: 0 # Not needed if lastUpdated is not enabled |
| 36 | + - name: Setup Node |
| 37 | + uses: actions/setup-node@v4 |
| 38 | + with: |
| 39 | + node-version: 20 |
| 40 | + - name: Setup Pages |
| 41 | + uses: actions/configure-pages@v5 |
| 42 | + - name: Install dependencies |
| 43 | + run: npm install |
| 44 | + - name: Copy logo to docs assets |
| 45 | + run: | |
| 46 | + mkdir -p docs/assets |
| 47 | + cp ../assets/logo.png docs/assets/ |
| 48 | + - name: Build with VitePress |
| 49 | + run: | |
| 50 | + npm run build |
| 51 | + touch docs/.vitepress/dist/.nojekyll |
| 52 | + - name: Ensure logo is in build output |
| 53 | + run: | |
| 54 | + mkdir -p docs/.vitepress/dist/assets |
| 55 | + cp ../assets/logo.png docs/.vitepress/dist/assets/ |
| 56 | + - name: Create single HTML bundle |
| 57 | + run: npm run bundle |
| 58 | + - name: Upload artifact for GitHub Pages |
| 59 | + uses: actions/upload-pages-artifact@v3 |
| 60 | + with: |
| 61 | + path: ./website/docs/.vitepress/dist |
| 62 | + - name: Upload single HTML bundle artifact |
| 63 | + uses: actions/upload-artifact@v4 |
| 64 | + with: |
| 65 | + name: single-html-bundle |
| 66 | + path: ./website/dist-single/index.html |
| 67 | + retention-days: 30 |
| 68 | + |
| 69 | + # Deployment job |
| 70 | + deploy: |
| 71 | + environment: |
| 72 | + name: github-pages |
| 73 | + url: ${{ steps.deployment.outputs.page_url }} |
| 74 | + needs: build |
| 75 | + runs-on: ubuntu-latest |
| 76 | + name: Deploy |
| 77 | + steps: |
| 78 | + - name: Deploy to GitHub Pages |
| 79 | + id: deployment |
| 80 | + uses: actions/deploy-pages@v4 |
0 commit comments