-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.34 KB
/
ci-kairos.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
name: production-kairos-fee-delegation-CI
on:
push:
branches:
- main
jobs:
build-and-push-image-to-ECR:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Get AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_IAM_ROLE_ARN_DEV }}
role-session-name: SessionForKlaytnActions
aws-region: ${{ vars.AWS_REGION_DEV }}
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
id: login-ecr
- name: Extract commit hash
id: vars
run: echo "::set-output name=hash::$(git rev-parse --short HEAD)"
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY_KAIROS }}
IMAGE_TAG: ${{ steps.vars.outputs.hash }}
API_URL: ${{ vars.KAIROS_API_URL }}
run: |
echo "NEXT_PUBLIC_API_URL= $API_URL" > .env.production
cat .env.production
docker build -f dockerfile --build-arg VERSION=$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY -a