Skip to content

Commit 6cea9ce

Browse files
committed
Enhance GitHub Pages deployment workflow by adding permissions for GITHUB_TOKEN, implementing concurrency control for deployments, and updating deployment steps to use the latest GitHub Actions for artifact upload and page deployment.
1 parent e3855c9 commit 6cea9ce

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

.github/workflows/deploy.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ on:
66
pull_request:
77
branches: [ main ]
88

9+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
16+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: false
20+
921
jobs:
1022
build-and-deploy:
1123
runs-on: ubuntu-latest
@@ -26,9 +38,14 @@ jobs:
2638
- name: Build and export
2739
run: npm run build
2840

29-
- name: Deploy to GitHub Pages
30-
uses: peaceiris/actions-gh-pages@v3
31-
if: github.ref == 'refs/heads/main'
41+
- name: Setup Pages
42+
uses: actions/configure-pages@v4
43+
44+
- name: Upload artifact
45+
uses: actions/upload-pages-artifact@v3
3246
with:
33-
github_token: ${{ secrets.GITHUB_TOKEN }}
34-
publish_dir: ./out
47+
path: ./out
48+
49+
- name: Deploy to GitHub Pages
50+
id: deployment
51+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)