|
5 | 5 | branches: [master] |
6 | 6 | pull_request: |
7 | 7 | branches: [master] |
8 | | - types: [opened, synchronize, reopened, closed] |
9 | 8 |
|
10 | 9 | permissions: |
11 | 10 | contents: write |
12 | 11 | pull-requests: write |
13 | | - statuses: write |
14 | | - id-token: write |
15 | | - |
16 | | -concurrency: |
17 | | - group: "pages" |
18 | | - cancel-in-progress: true |
19 | 12 |
|
20 | 13 | jobs: |
21 | | - build-and-deploy: |
| 14 | + build: |
22 | 15 | runs-on: ubuntu-latest |
| 16 | + |
23 | 17 | steps: |
24 | | - - name: Checkout 🛎️ |
| 18 | + - name: Checkout |
25 | 19 | uses: actions/checkout@v4 |
26 | 20 |
|
27 | | - - name: Setup Node.js |
| 21 | + - name: Setup Node.js |
28 | 22 | uses: actions/setup-node@v4 |
29 | 23 | with: |
30 | | - node-version: '20' |
| 24 | + node-version: 20 |
| 25 | + |
| 26 | + - name: Install dependencies |
| 27 | + run: npm ci |
| 28 | + |
| 29 | + - name: Build |
| 30 | + run: npm run build |
| 31 | + |
| 32 | + - name: Upload build artifact |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: site |
| 36 | + path: build/ |
| 37 | + |
| 38 | + deploy-pr-preview: |
| 39 | + # Runs ONLY for PRs |
| 40 | + if: ${{ github.event_name == 'pull_request' }} |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: build |
31 | 43 |
|
32 | | - - name: Install and Build 🔧 |
33 | | - run: | |
34 | | - npm ci |
35 | | - npm run build |
| 44 | + steps: |
| 45 | + - name: Download build artifact |
| 46 | + uses: actions/download-artifact@v4 |
| 47 | + with: |
| 48 | + name: site |
| 49 | + path: site |
36 | 50 |
|
37 | | - - name: Deploy Preview deploy-preview 🚀 |
38 | | - if: github.event_name == 'pull_request' |
39 | | - uses: rossjrw/pr-preview-action@v1 |
| 51 | + - name: Deploy PR Preview |
| 52 | + uses: JamesIves/github-pages-deploy-action@v4 |
| 53 | + with: |
| 54 | + branch: gh-pages-pr-previews |
| 55 | + folder: site |
| 56 | + target-folder: pr-${{ github.event.pull_request.number }} |
| 57 | + |
| 58 | + - name: Comment Preview URL |
| 59 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 60 | + with: |
| 61 | + recreate: true |
| 62 | + message: | |
| 63 | + 🚀 **Preview Ready!** |
| 64 | + Your docs preview for this PR is available here: |
| 65 | +
|
| 66 | + **https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-${{ github.event.pull_request.number }}/** |
| 67 | +
|
| 68 | + deploy-production: |
| 69 | + # Runs ONLY on push to master |
| 70 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 71 | + runs-on: ubuntu-latest |
| 72 | + needs: build |
| 73 | + |
| 74 | + steps: |
| 75 | + - name: Download build artifact |
| 76 | + uses: actions/download-artifact@v4 |
40 | 77 | with: |
41 | | - source-dir: ./build/ |
42 | | - preview-branch: gh-pages-pr-previews |
43 | | - umbrella-dir: pr-preview |
44 | | - action: auto |
| 78 | + name: site |
| 79 | + path: site |
45 | 80 |
|
46 | | - - name: Deploy to GitHub Pages 🚀 |
47 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 81 | + - name: Deploy to GitHub Pages |
48 | 82 | uses: JamesIves/github-pages-deploy-action@v4 |
49 | 83 | with: |
50 | 84 | branch: gh-pages |
51 | | - folder: build |
| 85 | + folder: site |
0 commit comments