Skip to content

Commit 0254e20

Browse files
committed
Reorganize deployment workflow Action
1 parent 47b4412 commit 0254e20

4 files changed

Lines changed: 58 additions & 9 deletions

File tree

.cache/pages.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
"consent",
2222
"contact",
2323
"offline",
24-
"privacy",
24+
{
25+
"privacy": [
26+
"my-data"
27+
]
28+
},
2529
{
2630
"services": [
2731
"create-custom-font-sets",

.github/workflows/build-and-test.yml

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,75 @@ jobs:
8787
path: coverage/
8888
retention-days: 30
8989

90-
# This job will only run after build-and-test succeeds
90+
# Deploy preview for pull requests
91+
deploy-preview:
92+
name: Deploy Preview to Vercel
93+
runs-on: ubuntu-latest
94+
needs: build-and-test
95+
if: github.event_name == 'pull_request'
96+
97+
steps:
98+
- name: Checkout repository
99+
uses: actions/checkout@v4
100+
101+
- name: Deploy to Vercel (Preview)
102+
uses: amondnet/vercel-action@v25
103+
id: vercel-preview
104+
with:
105+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
106+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
107+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
108+
github-comment: true
109+
env:
110+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
111+
112+
- name: Comment preview URL on PR
113+
uses: actions/github-script@v7
114+
if: github.event_name == 'pull_request'
115+
with:
116+
script: |
117+
const previewUrl = '${{ steps.vercel-preview.outputs.preview-url }}';
118+
github.rest.issues.createComment({
119+
issue_number: context.issue.number,
120+
owner: context.repo.owner,
121+
repo: context.repo.repo,
122+
body: `✅ Tests passed! Preview deployment ready:\n\n🔗 ${previewUrl}`
123+
});
124+
125+
# This job will only run after build-and-test succeeds on main branch
91126
deployment-ready:
92-
name: Deployment Gate
127+
name: Production Deployment Gate
93128
runs-on: ubuntu-latest
94129
needs: build-and-test
95-
if: github.ref == 'refs/heads/main'
130+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
96131

97132
steps:
98133
- name: All tests passed
99-
run: echo "✅ All tests passed. Deployment can proceed."
100-
deploy-to-vercel:
101-
name: Deploy to Vercel
134+
run: echo "✅ All tests passed. Production deployment can proceed."
135+
136+
# Deploy to production when PR is merged to main
137+
deploy-production:
138+
name: Deploy to Production (Vercel)
102139
runs-on: ubuntu-latest
103140
needs: deployment-ready
104-
if: github.ref == 'refs/heads/main' && success()
141+
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && success()
105142

106143
steps:
107144
- name: Checkout repository
108145
uses: actions/checkout@v4
109146

110-
- name: Deploy to Vercel
147+
- name: Deploy to Vercel (Production)
111148
uses: amondnet/vercel-action@v25
149+
id: vercel-production
112150
with:
113151
vercel-token: ${{ secrets.VERCEL_TOKEN }}
114152
vercel-args: '--prod'
115153
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
116154
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
117155
env:
118156
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
157+
158+
- name: Log production deployment
159+
run: |
160+
echo "🚀 Production deployment completed"
161+
echo "Production URL: ${{ steps.vercel-production.outputs.preview-url }}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ build/Release
6161

6262
# Dolphin-generated file
6363
.directory
64+
.vercel

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"cSpell.words": [
99
"Abbrs",
1010
"Acronis",
11+
"amondnet",
1112
"Asana",
1213
"bento",
1314
"bezier",

0 commit comments

Comments
 (0)