-
Notifications
You must be signed in to change notification settings - Fork 406
54 lines (46 loc) · 1.34 KB
/
.reusable-frontend-deploy.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
# reusable workflow
on:
workflow_call:
inputs:
gh_environment:
type: string
description: Github environment to use for secret / variable access
required: true
npm_build_environment:
type: string
description: The environment set as the ENV environment variable when running npm run env
required: true
defaults:
run:
working-directory: frontend
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.gh_environment }}
permissions:
contents: read
steps:
- name: Cloning repo
uses: actions/checkout@v4
- name: Setup Node.js 16.x
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Deploy to Vercel
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
ENV: ${{ inputs.npm_build_environment }}
run: |
npm ci --only=prod
npm run env
npm run bundle
echo ${{ github.sha }} > CI_COMMIT_SHA
npm install --global vercel@31.2.0
vercel --prod --token ${{ secrets.VERCEL_TOKEN }}