-
Notifications
You must be signed in to change notification settings - Fork 24
63 lines (57 loc) · 2.25 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
61
62
63
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 }}
HELM_GOOGLE_ANALYTICS_KEY: ${{ secrets.GOOGLE_ANALYTICS_KEY }}
HELM_LOG_ROCKET_APP_ID: ${{ secrets.LOG_ROCKET_APP_ID }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
NODE_OPTIONS: "--max-old-space-size=7168"
HELM_NEXT_PUBLIC_LAUNCHDARKLY_ID: ${{ secrets.NEXT_PUBLIC_LAUNCHDARKLY_ID }}
HELM_NEXT_PUBLIC_LAUNCHDARKLY_SDK_KEY: ${{ secrets.NEXT_PUBLIC_LAUNCHDARKLY_SDK_KEY }}
HELM_OPEN_SEARCH_USERNAME: ${{ secrets.OPEN_SEARCH_USERNAME }}
HELM_OPEN_SEARCH_PASSWORD: ${{ secrets.OPEN_SEARCH_PASSWORD }}
HELM_DD_APPLICATION_ID: ${{ secrets.DD_APPLICATION_ID }}
HELM_DD_CLIENT_TOKEN: ${{ secrets.DD_CLIENT_TOKEN }}
jobs:
deploy:
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 $APP_NAME --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@main
with:
name: ${{ env.APP_NAME }}
namespace: ${{ env.DEPLOYMENT_NAMESPACE }}
tag: ${{ steps.get-latest-tag.outputs.tag }}
chart_directory: deployment/app-chart
- name: Tag Previous Image
uses: tmknom/retag-ecr-action@v1
with:
repository-name: ${{ env.APP_NAME }}
source-tag: prod-current
destination-tag: prod-previous
- name: Tag Current Image
uses: tmknom/retag-ecr-action@v1
with:
repository-name: ${{ env.APP_NAME }}
source-tag: latest
destination-tag: prod-current