-
Notifications
You must be signed in to change notification settings - Fork 13
64 lines (54 loc) · 1.79 KB
/
gh-verify-branch.yaml
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
# Workflow to build and verify branch
# Name of Workflow
name: verify-branch
# Controls when the action will run. Triggers the workflow on push
# events but only for specified branches
on:
push:
branches:
- main
- develop
env:
PRODUCTION_BRANCH: main
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
deploy-branch:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Make some more metadata available as variables
id: metadata
run: |
TRIGGER_BRANCH=${GITHUB_REF##*/}
echo "TRIGGER_BRANCH=${TRIGGER_BRANCH}" | tee -a "$GITHUB_ENV" | tee -a "$GITHUB_OUTPUT"
echo "DEPLOY_NAME=BRANCH-${TRIGGER_BRANCH}" | tee -a "$GITHUB_ENV" | tee -a "$GITHUB_OUTPUT"
if [ "${TRIGGER_BRANCH}" == "${PRODUCTION_BRANCH}" ]
then
echo "VERCEL_ARGS=--prod" | tee -a "$GITHUB_ENV" | tee -a "${GITHUB_OUTPUT}"
fi
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive # Fetch private content
fetch-depth: 1 # Fetch all history for .GitInfo and .Lastmod
# Initiate GH deployment status
- name: Start Deployment
uses: bobheadxi/[email protected]
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: vercel-deploy-${{ steps.metadata.outputs.DEPLOY_NAME }}
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Run unit tests
env:
NODE_OPTIONS: "--max_old_space_size=8192"
run: |
npm ci
npm run test
- name: 🔨 Build project
run: npm run build