Skip to content

Commit 93985e4

Browse files
AchoArnoldCopilot
andcommitted
ci(web): run validation on PRs, deploy only on merge to main
- Split workflow into 'validate' (lint, test, build) and 'deploy' jobs - Validate runs on both pull_request and push to main - Deploy only runs after merge to main, gated behind validate passing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 01ec3c1 commit 93985e4

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

.github/workflows/web.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ on:
44
push:
55
branches:
66
- main
7+
pull_request:
8+
branches:
9+
- main
710

811
defaults:
912
run:
1013
working-directory: ./web
1114

1215
jobs:
13-
ci:
14-
name: Build & Deploy
16+
validate:
17+
name: Validate
1518
runs-on: ${{ matrix.os }}
1619

1720
strategy:
@@ -37,8 +40,26 @@ jobs:
3740
- name: Run tests 🧪
3841
run: pnpm test
3942

40-
- name: Debug 🐛
41-
run: echo GITHUB_SHA=${GITHUB_SHA}
43+
- name: Build 🏗️
44+
run: mv .env.production .env && echo GITHUB_SHA=${GITHUB_SHA} >> .env && pnpm run generate
45+
46+
deploy:
47+
name: Deploy
48+
needs: validate
49+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Checkout 🛎
54+
uses: actions/checkout@master
55+
56+
- uses: pnpm/action-setup@v6
57+
name: Install pnpm
58+
with:
59+
version: 10
60+
61+
- name: Install dependencies 📦
62+
run: pnpm install
4263

4364
- name: Build 🏗️
4465
run: mv .env.production .env && echo GITHUB_SHA=${GITHUB_SHA} >> .env && pnpm run generate

0 commit comments

Comments
 (0)