|
1 | | -name: Deploy to GitHub Pages |
| 1 | +# Simple workflow for deploying static content to GitHub Pages |
| 2 | +name: Deploy static content to Pages |
2 | 3 |
|
3 | 4 | on: |
4 | | - # Run on pushes to the default branch |
| 5 | + # Runs on pushes targeting the default branch |
5 | 6 | push: |
6 | | - branches: |
7 | | - - main |
| 7 | + branches: ["main"] |
8 | 8 |
|
9 | | - # ... Also run manually |
| 9 | + # Allows you to run this workflow manually from the Actions tab |
10 | 10 | workflow_dispatch: |
11 | 11 |
|
12 | | -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
13 | | -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 12 | +# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + pages: write |
| 16 | + id-token: write |
| 17 | + |
| 18 | +# Allow one concurrent deployment |
14 | 19 | concurrency: |
15 | 20 | group: "pages" |
16 | | - cancel-in-progress: false |
17 | | - |
18 | | -# Default to bash |
19 | | -defaults: |
20 | | - run: |
21 | | - shell: bash |
| 21 | + cancel-in-progress: true |
22 | 22 |
|
23 | 23 | jobs: |
24 | | - # Build job |
25 | | - build: |
26 | | - runs-on: ubuntu-22.04 |
27 | | - timeout-minutes: 10 |
28 | | - permissions: |
29 | | - contents: write |
30 | | - pull-requests: read |
31 | | - env: |
32 | | - INPUT_PATH: "dist/" |
| 24 | + # Single deploy job since we're just deploying |
| 25 | + deploy: |
| 26 | + environment: |
| 27 | + name: github-pages |
| 28 | + url: ${{ steps.deployment.outputs.page_url }} |
| 29 | + runs-on: ubuntu-latest |
33 | 30 | steps: |
34 | 31 | - name: Checkout |
35 | | - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 |
36 | | - |
37 | | - - name: Set up Node.js |
38 | | - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 |
| 32 | + uses: actions/checkout@v4 |
| 33 | + - name: Set up Node |
| 34 | + uses: actions/setup-node@v4 |
39 | 35 | with: |
40 | 36 | node-version: "22.12.x" |
41 | | - |
| 37 | + cache: "yarn" |
42 | 38 | - name: Install dependencies |
43 | 39 | run: yarn |
44 | | - |
45 | 40 | - name: Build |
46 | 41 | run: yarn build |
47 | | - |
48 | | - - name: Fix permissions |
49 | | - run: | |
50 | | - chmod -c -R +rX "$INPUT_PATH" | while read line; do |
51 | | - echo "::warning title=Invalid file permissions automatically fixed::$line" |
52 | | - done |
53 | | -
|
54 | | - - name: Archive artifact |
55 | | - shell: sh |
56 | | - run: | |
57 | | - echo ::group::Archive artifact |
58 | | - tar \ |
59 | | - --dereference --hard-dereference \ |
60 | | - --directory "$INPUT_PATH" \ |
61 | | - -cvf "$RUNNER_TEMP/artifact.tar" \ |
62 | | - --exclude=.git \ |
63 | | - --exclude=.github \ |
64 | | - --exclude=*/node_modules/* \ |
65 | | - --exclude=node_modules/* \ |
66 | | - $(test -f ../.releaseignore && echo "--exclude-from=../.releaseignore") \ |
67 | | - . |
68 | | - echo ::endgroup:: |
69 | | - env: |
70 | | - INPUT_PATH: ${{ env.INPUT_PATH }} |
71 | | - |
| 42 | + - name: Setup Pages |
| 43 | + uses: actions/configure-pages@v5 |
72 | 44 | - name: Upload artifact |
73 | | - id: upload-artifact |
74 | | - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 |
| 45 | + uses: actions/upload-pages-artifact@v3 |
75 | 46 | with: |
76 | | - name: github-pages |
77 | | - path: ${{ runner.temp }}/artifact.tar |
78 | | - retention-days: 1 |
79 | | - if-no-files-found: error |
80 | | - |
81 | | - deploy: |
82 | | - needs: build |
83 | | - runs-on: ubuntu-22.04 |
84 | | - timeout-minutes: 10 |
85 | | - permissions: |
86 | | - pages: write # to deploy to Pages |
87 | | - id-token: write # to verify the deployment originates from an appropriate source |
88 | | - environment: |
89 | | - name: github-pages |
90 | | - url: ${{ steps.deployment.outputs.page_url }} |
91 | | - steps: |
| 47 | + # Upload dist folder |
| 48 | + path: "./dist" |
92 | 49 | - name: Deploy to GitHub Pages |
93 | 50 | id: deployment |
94 | | - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e |
| 51 | + uses: actions/deploy-pages@v4 |
0 commit comments