-
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (37 loc) · 1.29 KB
/
ecr_api.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
name: AWS ECR API
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.sha || github.sha}}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws-us-gov:iam::${{secrets.AWS_ACCOUNT_ID}}:role/Github-ECR-Builder
role-session-name: GithubECRBuilder
aws-region: ${{secrets.AWS_REGION}}
- name: Docker Build API
run: docker compose build api
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Docker Tag API
run: docker tag media-infra-api:latest ${{secrets.AWS_ACCOUNT_ID}}.dkr.ecr.${{secrets.AWS_REGION}}.amazonaws.com/coe-ecr-media:${{github.event.pull_request.head.sha || github.sha}}
- name: Docker Push API
run: docker push ${{secrets.AWS_ACCOUNT_ID}}.dkr.ecr.${{secrets.AWS_REGION}}.amazonaws.com/coe-ecr-media:${{github.event.pull_request.head.sha || github.sha}}