-
-
Notifications
You must be signed in to change notification settings - Fork 5
65 lines (53 loc) · 2.35 KB
/
ecr_task.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
name: AWS ECR Task
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
strategy:
matrix:
task: [task, pmtiles, hooks, events]
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.sha || github.sha}}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
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 Task
run: docker compose build ${{ matrix.task }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Docker Tag Task
run: docker tag cloudtak-${{matrix.task}}:latest ${{secrets.AWS_ACCOUNT_ID}}.dkr.ecr.${{secrets.AWS_REGION}}.amazonaws.com/coe-ecr-etl:${{matrix.task}}-${{github.event.pull_request.head.sha || github.sha}}
- name: Docker Push task
run: docker push ${{secrets.AWS_ACCOUNT_ID}}.dkr.ecr.${{secrets.AWS_REGION}}.amazonaws.com/coe-ecr-etl:${{matrix.task}}-${{github.event.pull_request.head.sha || github.sha}}
- name: Configure AWS Credentials (STAGING)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{secrets.AWS_STAGING_ACCOUNT_ID}}:role/Github-ECR-Builder
role-session-name: GithubECRBuilder
aws-region: ${{secrets.AWS_STAGING_REGION}}
- name: Login to Amazon ECR (STAGING)
id: login-ecr-staging
uses: aws-actions/amazon-ecr-login@v2
- name: Docker Tag Task (STAGING)
run: docker tag cloudtak-${{matrix.task}}:latest ${{secrets.AWS_STAGING_ACCOUNT_ID}}.dkr.ecr.${{secrets.AWS_STAGING_REGION}}.amazonaws.com/coe-ecr-etl:${{matrix.task}}-${{github.event.pull_request.head.sha || github.sha}}
- name: Docker Push task (STAGING)
run: docker push ${{secrets.AWS_STAGING_ACCOUNT_ID}}.dkr.ecr.${{secrets.AWS_STAGING_REGION}}.amazonaws.com/coe-ecr-etl:${{matrix.task}}-${{github.event.pull_request.head.sha || github.sha}}