|
1 | 1 | name: Deploy to GitHub Pages |
2 | 2 |
|
3 | 3 | on: |
4 | | - # Deploy main branch to production |
5 | 4 | push: |
6 | 5 | branches: ["main"] |
7 | | - |
8 | | - # Deploy PR previews |
9 | | - pull_request: |
10 | | - branches: ["main"] |
11 | | - types: [opened, synchronize, reopened, closed] |
12 | | - |
13 | | - # Allow manual deployment |
14 | 6 | workflow_dispatch: |
15 | 7 |
|
16 | 8 | permissions: |
17 | | - contents: write |
18 | | - pull-requests: write |
| 9 | + contents: read |
| 10 | + pages: write |
| 11 | + id-token: write |
19 | 12 |
|
20 | 13 | concurrency: |
21 | | - group: pages-${{ github.ref }} |
| 14 | + group: "pages" |
22 | 15 | cancel-in-progress: false |
23 | 16 |
|
24 | 17 | jobs: |
25 | 18 | deploy: |
26 | | - # Skip on PR close events (handled by cleanup job) |
27 | | - if: github.event.action != 'closed' |
| 19 | + environment: |
| 20 | + name: github-pages |
| 21 | + url: ${{ steps.deployment.outputs.page_url }} |
28 | 22 | runs-on: ubuntu-latest |
29 | 23 | steps: |
30 | 24 | - name: Checkout |
31 | 25 | uses: actions/checkout@v4 |
32 | 26 |
|
33 | | - - name: Deploy to GitHub Pages |
34 | | - uses: rossjrw/pr-preview-action@v1 |
35 | | - with: |
36 | | - source-dir: ./docs |
37 | | - preview-branch: gh-pages |
38 | | - umbrella-dir: pr-previews |
39 | | - action: auto |
40 | | - |
41 | | - cleanup: |
42 | | - # Only run when PR is closed |
43 | | - if: github.event.action == 'closed' |
44 | | - runs-on: ubuntu-latest |
45 | | - steps: |
46 | | - - name: Checkout |
47 | | - uses: actions/checkout@v4 |
| 27 | + - name: Setup Pages |
| 28 | + uses: actions/configure-pages@v4 |
48 | 29 |
|
49 | | - - name: Remove PR Preview |
50 | | - uses: rossjrw/pr-preview-action@v1 |
| 30 | + - name: Upload artifact |
| 31 | + uses: actions/upload-pages-artifact@v3 |
51 | 32 | with: |
52 | | - source-dir: ./docs |
53 | | - preview-branch: gh-pages |
54 | | - umbrella-dir: pr-previews |
55 | | - action: remove |
| 33 | + path: './docs' |
| 34 | + |
| 35 | + - name: Deploy to GitHub Pages |
| 36 | + id: deployment |
| 37 | + uses: actions/deploy-pages@v4 |
0 commit comments