-
Notifications
You must be signed in to change notification settings - Fork 12
60 lines (54 loc) · 2.08 KB
/
deploy-prod-latest.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
name: Deploy Latest Image
on:
workflow_dispatch:
inputs:
environment:
required: true
description: Specify environment to run on. Valid values are test, production
default: production
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:
deploy:
strategy:
matrix:
app: [api, aggregator, notifier, draft, indexer-processor]
fail-fast: false
runs-on: ubuntu-latest
name: Deploy
environment:
name: ${{ github.event.inputs.environment }}
steps:
- uses: actions/checkout@v3
- name: Set Environment
run: |
cat ".github/env.common" >>$GITHUB_ENV
cat ".github/env.${{ github.event.inputs.environment }}" >>$GITHUB_ENV
- name: Get Latest Tag
id: get-latest-tag
run: |
TAG=$(aws ecr describe-images --repository-name astro-${{ matrix.app }} --region $AWS_DEFAULT_REGION | jq -r '.imageDetails | .[].imageTags | select(index( "latest" )) | .[] | select(.|test("^[a-f0-9]{40}$"))' | sed -e '2,$d')
echo "::set-output name=tag::$TAG"
- name: Helm Deploy
uses: near-daos/github-actions/deploy@v3
with:
name: astro-${{ matrix.app }}
namespace: ${{ env.DEPLOYMENT_NAMESPACE }}
tag: ${{ steps.get-latest-tag.outputs.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: ${{ steps.get-latest-tag.outputs.tag }}
destination-tag: ${{ github.event.inputs.environment }}-current