|
1 | | -name: Publish docs via GitHub Pages |
| 1 | +name: Deploy VitePress site to Pages |
| 2 | + |
2 | 3 | on: |
| 4 | + # Runs on pushes targeting the `main` branch. Change this to `master` if you're |
| 5 | + # using the `master` branch as the default branch. |
3 | 6 | push: |
4 | | - branches: |
5 | | - - main |
| 7 | + branches: [main] |
| 8 | + |
| 9 | + # Allows you to run this workflow manually from the Actions tab |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
6 | 13 | permissions: |
7 | | - contents: write |
| 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 | + |
8 | 24 | jobs: |
9 | | - deploy: |
10 | | - name: Deploy docs |
| 25 | + # Build job |
| 26 | + build: |
11 | 27 | runs-on: ubuntu-latest |
12 | 28 | steps: |
13 | | - - name: Checkout main |
| 29 | + - name: Checkout |
14 | 30 | uses: actions/checkout@v4 |
15 | | - - name: Configure Git Credentials |
16 | | - run: | |
17 | | - git config user.name github-actions[bot] |
18 | | - git config user.email 41898282+github-actions[bot]@users.noreply.github.com |
19 | | - - uses: actions/setup-python@v5 |
20 | 31 | with: |
21 | | - python-version: 3.x |
22 | | - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV |
23 | | - - uses: actions/cache@v4 |
| 32 | + fetch-depth: 0 # Not needed if lastUpdated is not enabled |
| 33 | + # - uses: pnpm/action-setup@v3 # Uncomment this block if you're using pnpm |
| 34 | + # with: |
| 35 | + # version: 9 # Not needed if you've set "packageManager" in package.json |
| 36 | + # - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun |
| 37 | + - name: Setup Node |
| 38 | + uses: actions/setup-node@v4 |
| 39 | + with: |
| 40 | + node-version: 24 |
| 41 | + cache: npm # or pnpm / yarn |
| 42 | + - name: Setup Pages |
| 43 | + uses: actions/configure-pages@v4 |
| 44 | + - name: Install dependencies |
| 45 | + run: npm ci # or pnpm install / yarn install / bun install |
| 46 | + - name: Build with VitePress |
| 47 | + run: npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build |
| 48 | + - name: Upload artifact |
| 49 | + uses: actions/upload-pages-artifact@v3 |
24 | 50 | with: |
25 | | - key: mkdocs-material-${{ env.cache_id }} |
26 | | - path: .cache |
27 | | - restore-keys: | |
28 | | - mkdocs-material- |
29 | | - - run: pip install mkdocs-material |
30 | | - - name: Deploy docs |
31 | | - run: mkdocs gh-deploy --force |
32 | | -env: |
33 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + path: docs/.vitepress/dist |
| 52 | + |
| 53 | + # Deployment job |
| 54 | + deploy: |
| 55 | + environment: |
| 56 | + name: github-pages |
| 57 | + url: ${{ steps.deployment.outputs.page_url }} |
| 58 | + needs: build |
| 59 | + runs-on: ubuntu-latest |
| 60 | + name: Deploy |
| 61 | + steps: |
| 62 | + - name: Deploy to GitHub Pages |
| 63 | + id: deployment |
| 64 | + uses: actions/deploy-pages@v4 |
0 commit comments