-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (57 loc) · 1.67 KB
/
build-infra.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
64
65
66
name: Build Infra
on:
push:
branches:
- main
workflow_dispatch: {}
jobs:
run:
name: run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Install the terraform and terragrunt
- uses: alexellis/setup-arkade@v1
- uses: alexellis/arkade-get@master
with:
terraform: latest
terragrunt: latest
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.PERSONAL_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.PERSONAL_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
aws-region: ${{ vars.AWS_REGION }}
role-skip-session-tagging: true
# Display IAM Identity
- name: Display IAM Identity
run: |
aws sts get-caller-identity
- name: Install jq
run: |
sudo apt install jq tree
- name: Get ECR arn
run: |
pwd
tree -dL 2
echo "ecr_arn=`terragrunt output --json | jq .ecr_repository_arn.value -r`" >> GITHUB_OUTPUT
working-directory: terraform
- name: Fetch ECS Repo Url
run: |
echo $ECR_ARN
# Build docker image
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: user/app:latest