Skip to content

Commit 02ff71e

Browse files
committed
Fix GitHub Actions permissions for Pages deployment
- Add proper permissions for GitHub Pages deployment - Use official GitHub Pages actions instead of third-party - Add concurrency control to prevent deployment conflicts - Remove pull_request trigger to only deploy on main branch pushes This should resolve the 403 permission error when deploying to GitHub Pages.
1 parent 2bdd4b3 commit 02ff71e

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

.github/workflows/deploy.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@ name: Deploy Vue Tetris to GitHub Pages
33
on:
44
push:
55
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
6+
7+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
14+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
818

919
jobs:
1020
build-and-deploy:
@@ -27,10 +37,14 @@ jobs:
2737
- name: Build
2838
run: npm run build
2939

30-
- name: Deploy to GitHub Pages
31-
uses: peaceiris/actions-gh-pages@v3
32-
if: github.ref == 'refs/heads/main'
40+
- name: Setup Pages
41+
uses: actions/configure-pages@v4
42+
43+
- name: Upload artifact
44+
uses: actions/upload-pages-artifact@v3
3345
with:
34-
github_token: ${{ secrets.GITHUB_TOKEN }}
35-
publish_dir: dist
36-
cname: # Optional: add your custom domain here
46+
path: ./dist
47+
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)