-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (80 loc) · 2.87 KB
/
ci.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
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
name: Checks & Release
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
main:
name: Run checks and deploy
runs-on: [self-hosted, fear]
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 16
- name: Set GitHub packages registry
run: |
npm config set '//npm.pkg.github.com/:_authToken' ${{ secrets.GH_TOKEN }}
npm config set @typeform:registry https://npm.pkg.github.com/
- name: Get yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('.github/workflows/**.yml') }}
- name: Install Node.js dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Run linter
run: yarn lint
# - name: Run tests
# run: yarn test --coverage
- name: Run compile
run: yarn compile
- name: Build image
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GH_TOKEN }}" > .npmrc
echo "@typeform:registry=https://npm.pkg.github.com" >> .npmrc
make build
if: ${{!contains(github.event.head_commit.message, 'chore')}}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_SHA: ${GITHUB_SHA}
VERSION: ${GITHUB_RUN_ID}
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
- name: Push version images
if: ${{!contains(github.event.head_commit.message, 'chore')}}
run: make push
env:
VERSION: ${GITHUB_RUN_ID}
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
- name: Push latest images
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore')
run: make push
env:
VERSION: 'latest'
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
- name: Deploy
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore')
run: make deploy
env:
JENKINS_OKTA_USERNAME: ${{ secrets.JENKINS_OKTA_USERNAME }}
JENKINS_USER_TOKEN: ${{ secrets.JENKINS_USER_TOKEN }}
VERSION: ${GITHUB_RUN_ID}
- name: Build number
run: echo ${GITHUB_RUN_ID}
# - name: Set SonarCloud project
# run: sed -i 's/sonar\.projectVersion=.*/sonar\.projectVersion=${{ github.run_id }}/' sonar-project.properties
# - name: SonarCloud Scan
# uses: SonarSource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}