forked from cometbft/cometbft
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (86 loc) · 2.63 KB
/
docker-build-e2e-node.yml
File metadata and controls
96 lines (86 loc) · 2.63 KB
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
name: docker-build-e2e-node
on:
workflow_dispatch:
push:
branches:
- main
- v0.38.x
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DOCKER_ORG: cometbft
DOCKER_IMAGE: e2e-node
jobs:
vars:
runs-on: ubuntu-latest
outputs:
repo: ${{ steps.set.outputs.repo }}
tags: ${{ steps.set.outputs.tags }}
steps:
- id: set
run: |
REPO="${DOCKER_ORG}/${DOCKER_IMAGE}"
VERSION="${GITHUB_REF_NAME}"
TAGS="${REPO}:${VERSION}"
if [ "$VERSION" = "main" ]; then
TAGS="${TAGS:+$TAGS,}$REPO:latest"
fi
echo "repo=${REPO}" >> $GITHUB_OUTPUT
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
build-images:
needs: vars
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
arch: amd64
- os: ubuntu-24.04-arm
arch: arm64
runs-on: ${{ matrix.os }}
outputs:
digest-amd64: ${{ steps.digest.outputs.digest-amd64 }}
digest-arm64: ${{ steps.digest.outputs.digest-arm64 }}
steps:
- id: tags
run: |
TAGS=$(echo "${{ needs.vars.outputs.tags }}" | sed "s/[^,]*/&-${{ matrix.arch }}/g")
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v6
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
id: build
with:
platforms: linux/${{ matrix.arch }}
context: .
file: ./test/e2e/docker/Dockerfile
push: true
tags: ${{ steps.tags.outputs.tags }}
- id: digest
run: echo "digest-${{ matrix.arch }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
merge-images:
runs-on: ubuntu-latest
needs:
- vars
- build-images
steps:
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: |
TAGS="${{ needs.vars.outputs.tags }}"
docker buildx imagetools create \
$(printf -- '--tag %s ' ${TAGS//,/ }) \
${{ needs.vars.outputs.repo }}@${{ needs.build-images.outputs.digest-amd64 }} \
${{ needs.vars.outputs.repo }}@${{ needs.build-images.outputs.digest-arm64 }}