-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (64 loc) · 2.29 KB
/
trigger_build_push.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
66
67
68
69
70
71
72
name: Build and Push Docker Image
on:
workflow_dispatch:
inputs:
shardeum_branch:
description: 'Shardeum repository branch'
required: true
default: 'itn4-1.16.3'
relayer_collector_branch:
description: 'Relayer collector repository branch'
required: true
default: 'itn4'
json_rpc_server_branch:
description: 'JSON RPC server repository branch'
required: true
default: 'itn4'
image_tag:
description: 'Docker image tag'
required: true
default: 'itn4-1.16.3'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 120
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine architecture
id: arch
run: |
ARCH=$(uname -m)
if [ "$ARCH" == "aarch64" ] || [ "$ARCH" == "arm64" ]; then
echo "ARCH_TAG=arm64" >> $GITHUB_OUTPUT
elif [ "$ARCH" == "x86_64" ]; then
echo "ARCH_TAG=amd64" >> $GITHUB_OUTPUT
else
echo "Unsupported architecture: $ARCH. Exiting."
exit 1
fi
- name: Build Docker image
run: |
docker build \
--build-arg SHARDEUM_BRANCH=${{ inputs.shardeum_branch }} \
--build-arg RELAYER_COLLECTOR_BRANCH=${{ inputs.relayer_collector_branch }} \
--build-arg JSON_RPC_SERVER_BRANCH=${{ inputs.json_rpc_server_branch }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ steps.arch.outputs.ARCH_TAG }}:${{ inputs.image_tag }} \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ steps.arch.outputs.ARCH_TAG }}:latest \
.
- name: Push Docker image
run: |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ steps.arch.outputs.ARCH_TAG }}:${{ inputs.image_tag }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ steps.arch.outputs.ARCH_TAG }}:latest