-
Notifications
You must be signed in to change notification settings - Fork 12
83 lines (77 loc) · 2.83 KB
/
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
name: Deploy
on:
workflow_dispatch:
inputs:
environment:
required: true
description: Specify environment to run on. Valid values are test, production
tag:
required: true
description: Docker tag to deploy. Valid values are "latest", "<branch>-latest", "<commit_sha>". Exact values can be found in "Docker Build Publish" step of "Build Deploy" job.
default: latest
apps:
required: false
default: aggregator api draft notifier indexer-processor
description: List of application to deploy (space separated).
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ECR_URL: ${{ secrets.AWS_ECR_URL }}
EKS_CLUSTER_NAME: ${{ secrets.EKS_CLUSTER_NAME }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
jobs:
get-updated-apps:
name: Get Updated Apps
runs-on: ubuntu-latest
outputs:
updated-apps: ${{ steps.updated-apps.outputs.apps }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- id: updated-apps
shell: bash
run: |
array_to_json () {
echo "[$(echo $1 | xargs | sed -e 's| |", "|g;s|.*|"&"|')]"
}
echo "List of apps was provided manually: ${{ github.event.inputs.apps }}"
export UPDATED_APPS=$(array_to_json "${{ github.event.inputs.apps }}")
echo "::set-output name=apps::$UPDATED_APPS"
helm-deploy:
name: Helm Deploy
runs-on: ubuntu-latest
needs:
- get-updated-apps
strategy:
matrix:
app: ${{ fromJSON(needs.get-updated-apps.outputs.updated-apps) }}
fail-fast: false
environment:
name: ${{ github.event.inputs.environment }}
steps:
- uses: actions/checkout@v2
- name: Set Environment
run: |
echo DOCKER_ENV_TAG=${{ github.event.inputs.tag }} >> $GITHUB_ENV
cat ".github/env.common" | grep -E -v '^\ *#' >>$GITHUB_ENV
cat ".github/env.${{ github.event.inputs.environment }}" | grep -E -v '^\ *#' >>$GITHUB_ENV
- name: Helm Deploy
uses: near-daos/github-actions/deploy@v3
with:
name: astro-${{ matrix.app }}
namespace: ${{ env.DEPLOYMENT_NAMESPACE }}
tag: ${{ github.event.inputs.tag }}
chart_directory: apps/${{ matrix.app }}/deployment/app-chart
- name: Tag Previous Image
uses: tmknom/retag-ecr-action@v1
with:
repository-name: astro-${{ matrix.app }}
source-tag: ${{ github.event.inputs.environment }}-current
destination-tag: ${{ github.event.inputs.environment }}-previous
- name: Tag Current Image
uses: tmknom/retag-ecr-action@v1
with:
repository-name: astro-${{ matrix.app }}
source-tag: ${{ github.event.inputs.tag }}
destination-tag: ${{ github.event.inputs.environment }}-current