generated from hasparus/zaduma
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (70 loc) · 2.23 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: CI
on:
push:
workflow_dispatch:
jobs:
test-build-and-deploy:
runs-on: macos-latest
permissions:
deployments: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "pnpm"
- name: Install
id: install
run: |
pnpm install --no-optional --frozen-lockfile ${{ env.IS_DEPENDABOT == 0 }}
- name: Commit lockfile
if: ${{ env.IS_DEPENDABOT == 1 }}
uses: EndBug/add-and-commit@v9
with:
{ add: "pnpm-lock.yaml", fetch: false, message: "Update lockfile" }
- name: Run linter
run: pnpm lint --quiet
- name: Typecheck
run: pnpm typecheck
- name: Build
run: pnpm build
env:
OG_IMAGE_SECRET: ${{ secrets.OG_IMAGE_SECRET }}
- name: Deploy Production to Vercel
if: github.ref_name == 'main'
run:
node .github/scripts/deploy.mjs --token=${{ secrets.VERCEL_TOKEN }}
--prod
- name: Deploy Preview to Vercel
if: github.ref_name != 'main'
run: node .github/scripts/deploy.mjs --token=${{ secrets.VERCEL_TOKEN }}
- name: Create GitHub Preview Deployment
if: github.ref_name != 'main'
uses: chrnorm/deployment-action@v2
with:
token: "${{ github.token }}"
environment-url: https://${{ env.DEPLOYMENT_ALIAS }} # <- set by deploy.mjs
environment: Preview
production-environment: false
initial-status: success
- name: Create GitHub Production Deployment
if: github.ref_name == 'main'
uses: chrnorm/deployment-action@v2
with:
token: "${{ github.token }}"
environment-url: https://siddharthcodes.vercel.app
environment: Production
production-environment: true
initial-status: success
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
REF_NAME: "${{ github.ref_name }}"
IS_DEPENDABOT: ${{ secrets.IS_DEPENDABOT }}