-
Notifications
You must be signed in to change notification settings - Fork 5
71 lines (64 loc) · 2.06 KB
/
continuous-integration.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
name: continuous-integration
on:
workflow_dispatch:
push:
branches:
- main
- staging
release:
types: [published]
jobs:
continuous-integration:
name: continuous-integration
runs-on: ubuntu-latest
strategy:
matrix:
projects: [admin-ui, server]
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: install dependencies ${{ matrix.projects }}
working-directory: ${{ matrix.projects }}
run: npm install
- name: build ${{ matrix.projects }} component
working-directory: ${{ matrix.projects }}
run: npm run build
- name: test ${{ matrix.projects }} component
working-directory: ${{ matrix.projects }}
run: npm run test
configure:
name: configure deployment target environment
runs-on: ubuntu-20.04
outputs:
environment: ${{ steps.environment-identifier.outputs.environment }}
steps:
- id: environment-identifier
run: |
if [[ "${{ github.ref_name }}" == "${{ github.event.repository.default_branch }}" ]];
then
echo environment="staging" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "staging" ]];
then
echo environment="staging" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_type }}" == "tag" ]];
then
echo environment="production" >> $GITHUB_OUTPUT
fi;
release:
name: release
needs: [continuous-integration, configure]
uses: ./.github/workflows/release.template.yml
strategy:
matrix:
projects: [admin-ui, server]
with:
branch: ${{ github.ref_name }}
environment-name: ${{ needs.configure.outputs.environment }}
project-name: ${{ matrix.projects }}
secrets:
ECR_AWS_ACCESS_KEY_ID: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
ECR_AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}