-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (51 loc) · 1.83 KB
/
deploy-qa.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
name: Deploy to QA if tagged as QA release
on:
release:
types: [ released ]
permissions:
id-token: write
contents: read
jobs:
check_qa_tag:
name: Check if the release is tagged as QA
runs-on: ubuntu-latest
outputs:
has_qa_tag: ${{ steps.check-qa-tag.outputs.run_jobs }}
steps:
- name: check qa tag ${{ github.ref }}
id: check-qa-tag
run: |
if [[ ${{ github.ref }} =~ refs\/tags\/qa ]]; then
echo "run_jobs=true" >> $GITHUB_OUTPUT
else
echo "run_jobs=false" >> $GITHUB_OUTPUT
fi
publish_qa:
needs: [ check_qa_tag ]
if: needs.check_qa_tag.outputs.has_qa_tag == 'true'
name: Publish image to ECR and update ECS stack
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: pc-reserve-poller
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:qa-latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:qa-latest
- name: Force ECS Update
run: |
aws ecs update-service --cluster pc-reserve-poller-qa --service pc-reserve-poller-app-qa --force-new-deployment