-
Notifications
You must be signed in to change notification settings - Fork 117
99 lines (89 loc) · 3.07 KB
/
build-latest-docker-image.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Build and push latest docker image
on:
push:
branches:
- main
workflow_dispatch:
inputs:
buildDebug:
description: Whether or build the debug image ("true"/"false")
required: true
default: "false"
wasm:
description: Whether to enable wasm ("true"/"false")
required: true
default: "true"
ibc-wasm-hooks:
description: Whether to enable ibc wasm hooks ("true"/"false")
required: true
default: "false"
jobs:
build-and-push-latest-docker-image:
strategy:
matrix:
os:
- ubuntu-22.04
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: nelonoel/[email protected]
- name: fetch tags
run: |
git fetch --unshallow
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ghwf-${{ github.event.repository.name }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build docker image (normal)
# This action can be called automatically, so it is possible that inputs are not set.
# Therefore, a default is set in the env section and then the inputs are explicitly checked in the run section
# instead of binding them directly in the env section.
env:
WASM: "true"
IBC_WASM_HOOKS: "false"
run: |
if [ "${{ github.event.inputs.wasm }}" == "false" ]; then
export WASM="false"
fi
if [ "${{ github.event.inputs.ibc-wasm-hooks }}" == "true" ]; then
export IBC_WASM_HOOKS="true"
fi
make docker-image
- name: Push to ECR (normal)
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: axelar-core
IMAGE_TAG: ${{ github.sha }}
run: |
docker image tag axelar/core "${REGISTRY}/${REPOSITORY}:${IMAGE_TAG}"
docker push "${REGISTRY}/${REPOSITORY}:${IMAGE_TAG}"
- name: Build docker image (debug)
env:
WASM: "true"
IBC_WASM_HOOKS: "false"
if: github.event.inputs.buildDebug != 'false'
run: |
if [ "${{ github.event.inputs.wasm }}" == "false" ]; then
export WASM="false"
fi
if [ "${{ github.event.inputs.ibc-wasm-hooks }}" == "true" ]; then
export IBC_WASM_HOOKS="true"
fi
make docker-image-debug
- name: Push to ECR (debug)
if: github.event.inputs.buildDebug != 'false'
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: axelar-core
IMAGE_TAG: ${{ github.sha }}
run: |
docker image tag axelar/core "${REGISTRY}/${REPOSITORY}:${IMAGE_TAG}-debug"
docker push "${REGISTRY}/${REPOSITORY}:${IMAGE_TAG}-debug"