-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (60 loc) · 2.43 KB
/
manual-promote-release-in-prod.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
72
name: Manual promote release in prod
on:
workflow_dispatch:
inputs:
release:
description: 'Which release to promote in prod:'
type: string
required: true
defaults:
run:
shell: bash
permissions:
id-token: write # This is required for requesting the JWT
contents: write # This is required for actions/checkout
jobs:
manual-promote-release-in-prod:
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
strategy:
matrix:
environment: [uat]
name: "manual-promote-release-in-prod"
runs-on: ubuntu-latest
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2
- name: Configure uat AWS Credentials
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838
with:
role-to-assume: ${{ secrets.IAM_ROLE }}
aws-region: ${{ vars.AWS_REGION }}
- name: Login to uat Amazon ECR
id: login-ecr-uat
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2
- name: Copy docker image from uat ECR
env:
REGISTRY: ${{ steps.login-ecr-uat.outputs.registry }}
REPOSITORY: ${{ vars.DOCKER_IMAGE_NAME}}
UAT_IMAGE_TAG: ${{ inputs.release }}
run: |
docker pull $REGISTRY/$REPOSITORY:$UAT_IMAGE_TAG
- name: Configure prod AWS Credentials
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838
with:
role-to-assume: ${{ secrets.PROD_IAM_ROLE }}
aws-region: ${{ vars.AWS_REGION }}
- name: Login to prod Amazon ECR
id: login-ecr-prod
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2
- name: Push docker image in prod ECR
env:
PROD_REGISTRY: ${{ steps.login-ecr-prod.outputs.registry }}
UAT_REGISTRY: ${{ steps.login-ecr-uat.outputs.registry }}
PROD_REPOSITORY: ${{ vars.PROD_DOCKER_IMAGE_NAME}}
UAT_REPOSITORY: ${{ vars.DOCKER_IMAGE_NAME}}
PROD_IMAGE_TAG: ${{ inputs.release }}
UAT_IMAGE_TAG: ${{ inputs.release }}
run: |
docker tag $UAT_REGISTRY/$UAT_REPOSITORY:$UAT_IMAGE_TAG $PROD_REGISTRY/$PROD_REPOSITORY:$PROD_IMAGE_TAG
docker push $PROD_REGISTRY/$PROD_REPOSITORY:$PROD_IMAGE_TAG