Skip to content

Commit 3bc84b8

Browse files
committed
ci(github-actions): update deployment workflow
- Rename workflow to "Deploy to GitHub Pages" - Add push trigger for main branch - Split workflow into build and deployment jobs - Add staging deployment for pushes to main - Retain production deployment for releases
1 parent 9045f22 commit 3bc84b8

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
name: Deploy to GitHub Pages on Release
1+
name: Deploy to GitHub Pages
22

33
on:
4+
push:
5+
branches:
6+
- main
47
release:
58
types: [published]
69

7-
permissions:
8-
contents: read
9-
pages: write
10-
id-token: write
11-
1210
jobs:
13-
deploy:
11+
build:
1412
runs-on: ubuntu-latest
15-
1613
steps:
1714
- name: Checkout
1815
uses: actions/checkout@v4
@@ -29,14 +26,37 @@ jobs:
2926
- name: Build
3027
run: npm run build
3128

32-
- name: Setup Pages
33-
uses: actions/configure-pages@v5
34-
3529
- name: Upload artifact
3630
uses: actions/upload-pages-artifact@v3
3731
with:
3832
path: ./dist
3933

34+
deploy-staging:
35+
needs: build
36+
if: github.event_name == 'push'
37+
runs-on: ubuntu-latest
38+
permissions:
39+
pages: write
40+
id-token: write
41+
environment:
42+
name: github-pages
43+
url: ${{ steps.deployment.outputs.page_url }}
44+
steps:
45+
- name: Deploy to GitHub Pages
46+
id: deployment
47+
uses: actions/deploy-pages@v4
48+
49+
deploy-production:
50+
needs: build
51+
if: github.event_name == 'release'
52+
runs-on: ubuntu-latest
53+
permissions:
54+
pages: write
55+
id-token: write
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
steps:
4060
- name: Deploy to GitHub Pages
4161
id: deployment
4262
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)