-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (79 loc) · 2.63 KB
/
build-deploy.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
name: Build & Deploy
on:
workflow_dispatch:
inputs:
environment:
required: false
description: Specify environment to run on. Valid values are develop, production
push:
branches:
- develop
- staging
tags:
- "**"
env:
AWS_DEFAULT_REGION: us-east-1
AWS_ECR_URL: 570288326086.dkr.ecr.us-east-1.amazonaws.com
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
get-environment:
name: Get Environment
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.get-environment.outputs.environment }}
docker_env_tag: ${{ steps.get-environment.outputs.docker_env_tag }}
steps:
- name: get environment
id: get-environment
shell: bash
run: |
if [[ "${{ github.ref }}" =~ ^refs/tags.* ]]
then
echo "::set-output name=environment::production"
elif [[ "${{ github.ref }}" =~ ^refs/heads/develop ]]
then
echo "::set-output name=environment::development"
fi
echo "::set-output name=docker_env_tag::${GITHUB_REF#refs/*/}-$GITHUB_SHA"
build-image:
name: Build Image
runs-on: ubuntu-latest
needs:
- get-environment
environment:
name: ${{ needs.get-environment.outputs.environment }}
steps:
- uses: actions/checkout@v2
- name: Set Environment
run: |
echo DOCKER_ENV_TAG=${{ needs.get-environment.outputs.docker_env_tag }} >> $GITHUB_ENV
- name: Docker Build Publish
uses: ./.github/actions/docker-build-publish
helm-deploy:
name: Helm Deploy
runs-on: ubuntu-latest
if: always()
needs:
- get-environment
- build-image
steps:
- uses: actions/checkout@v2
- name: Set Environment
run: |
cat ".github/env.${{ needs.get-environment.outputs.environment }}" | grep -E -v '^\ *#' >>$GITHUB_ENV
- name: Helm Deploy
uses: koslib/[email protected]
with:
command: |
set -x
aws eks update-kubeconfig --name $EKS_CLUSTER_NAME --kubeconfig kubeconfig
export CHART_FOLDER=deployment/app-chart
helm lint $CHART_FOLDER
helm -n $EKS_NAMESPACE \
upgrade --install --create-namespace dao-stats-ui $CHART_FOLDER \
--set image.tag=${{ needs.get-environment.outputs.docker_env_tag }} \
--set environment.react_app_api_endpoint=$REACT_APP_API_ENDPOINT \
--set environment.react_app_mainnet=$REACT_APP_MAINNET \
--set environment.react_app_testnet=$REACT_APP_TESTNET \
--set ingress.host=$EKS_INGRESS_HOST