-
-
Notifications
You must be signed in to change notification settings - Fork 4
105 lines (89 loc) · 3.11 KB
/
deploy-production.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Deploy Production
on:
push:
branches:
- main
env:
SKIP_ENV_VALIDATION: 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-lint:
uses: ./.github/workflows/job_build.yaml
with:
pull_secrets: true
project_slug: unprice-zq-xm
env_slug: prod
secrets:
MACHINE_IDENTITY_CLIENT_ID: ${{ secrets.MACHINE_IDENTITY_CLIENT_ID }}
MACHINE_IDENTITY_CLIENT_SECRET: ${{ secrets.MACHINE_IDENTITY_CLIENT_SECRET }}
deploy-prod:
runs-on: ubuntu-latest
needs:
- build-lint
permissions:
pull-requests: write
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Infisical/[email protected]
name: Pull secrets from Infisical
with:
client-id: ${{ secrets.MACHINE_IDENTITY_CLIENT_ID }}
client-secret: ${{ secrets.MACHINE_IDENTITY_CLIENT_SECRET }}
env-slug: "prod"
project-slug: "unprice-zq-xm"
export-type: "file"
file-output-path: "/.env"
secret-path: "/"
recursive: true
- uses: ./.github/actions/install
with:
ts: true
- uses: cardinalby/export-env-action@v2
with:
envFile: '.env'
export: true
mask: true
- name: Apply Migrations
working-directory: internal/db
run: |
pnpm migrate:custom
env:
VERCEL_ENV: production
NODE_ENV: production
- name: Check for changes
id: turbo-ignore
continue-on-error: true
run: npx turbo-ignore -d apps/auth-proxy
- uses: amondnet/[email protected] #deploy
name: Deploy Unprice auth to Vercel
id: deploy-auth
# if turbo-ignore fails,that means there are no changes in the auth-proxy folder
if: steps.turbo-ignore.outcome == 'failure'
with:
vercel-token: ${{ env.VERCEL_TOKEN }} # Required
vercel-org-id: ${{ env.VERCEL_ORG_ID}} #Required
vercel-project-id: ${{ env.VERCEL_PROJECT_AUTH_UNPRICE_ID }} #Required
# always prod because the auth proxy link has to be stable
vercel-args: '--env VERCEL_ENV=production --env NODE_ENV=production --prod --build-env VERCEL_ENV=production --build-env NODE_ENV=production'
working-directory: ./
# deploy unprice to vercel
- uses: amondnet/[email protected] #deploy
name: Deploy Unprice to Vercel
id: deploy-unprice
with:
vercel-token: ${{ env.VERCEL_TOKEN }} # Required
vercel-org-id: ${{ env.VERCEL_ORG_ID}} #Required
vercel-project-id: ${{ env.VERCEL_PROJECT_UNPRICE_ID}} #Required
working-directory: ./
vercel-args: '--prod --env NEXT_PUBLIC_APP_DOMAIN=unprice.dev --env NEXT_PUBLIC_VERCEL_ENV=production --build-env NEXT_PUBLIC_APP_DOMAIN=unprice.dev --build-env NEXT_PUBLIC_VERCEL_ENV=production'
alias-domains: |
unprice.vercel.app
- name: Delete Secret
if: always()
run: |
rm -rf .env || true