Skip to content

Commit d227f95

Browse files
authored
chore(ci): update ci.yaml workflow (#105)
* chore(ci): update `ci.yaml` workflow * feat(ui): add `preview.yaml` and `production.yaml` * chore(ui): update `ci.yaml` workflow
1 parent 3a2e32d commit d227f95

3 files changed

Lines changed: 71 additions & 10 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: ci
22

33
on:
4-
pull_request:
5-
types: [opened, synchronize, closed]
4+
push:
5+
branches-ignore:
6+
- master
67

78
jobs:
89
build:
@@ -41,16 +42,8 @@ jobs:
4142
- run: pnpm test
4243

4344
deploy-to-development:
44-
if: github.event.pull_request.merged == true && github.base_ref == 'master'
4545
runs-on: ubuntu-latest
4646
needs: [build, test]
4747
environment: development
4848
steps:
4949
- run: echo "Deploying to development environment"
50-
51-
# deploy-to-production:
52-
# fi: github.event.pull_request.merged == true && github.base_ref == 'master' && startsWith(github.head_ref, 'release/')
53-
# runs-on: ubuntu-latest
54-
# needs: [build, test]
55-
# environment: production
56-
# steps:

.github/workflows/preview.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Vercel Preview Deployment
2+
3+
env:
4+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
5+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
6+
7+
on:
8+
push:
9+
branches-ignore:
10+
- master
11+
12+
jobs:
13+
deploy-preview:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: "18.x"
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Install Vercel CLI
25+
run: pnpm install -g vercel@latest
26+
27+
- name: Pull Vercel Environment Variables
28+
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
29+
30+
- name: Build Artifact
31+
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
32+
33+
- name: Deploy Artifact to Vercel
34+
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}

.github/workflows/production.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Vercel Production Deployment
2+
3+
env:
4+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
5+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
12+
jobs:
13+
deploy-to-production:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: "18.x"
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Install Vercel CLI
25+
run: pnpm install -g vercel@latest
26+
27+
- name: Pull Vercel Environment Variables
28+
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
29+
30+
- name: Build Artifact
31+
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
32+
33+
- name: Deploy Artifact to Vercel
34+
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}

0 commit comments

Comments
 (0)