1- name : Tag Based Image Build
2-
3- on :
4- release :
5- types : [created] # This listens to release creation events
6-
7- env :
8- REGISTRY_IMAGE : thirdweb/engine
9-
10- jobs :
11- build :
12- runs-on : ${{ matrix.runner }}
13- strategy :
14- matrix :
15- include :
16- - platform : linux/amd64
17- runner : ubuntu-latest
18- arch : amd64
19- - platform : linux/arm64
20- runner : ubuntu-24.04-arm64
21- arch : arm64
22- env :
23- LATEST_TAG : ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
24-
25- steps :
26- - name : Checkout code
27- uses : actions/checkout@v3
28- with :
29- ref : ${{ github.event.release.target_commitish }}
30-
31- - name : Set up Docker Buildx
32- uses : docker/setup-buildx-action@v3
33-
34- - name : Login to DockerHub
35- uses : docker/login-action@v3
36- with :
37- username : ${{ secrets.DOCKER_USERNAME }}
38- password : ${{ secrets.DOCKER_PASSWORD }}
39-
40- - name : Build and Push Docker Image
41- uses : docker/build-push-action@v6
42- with :
43- context : .
44- target : prod
45- platforms : ${{ matrix.platform }}
46- push : true
47- tags : |
48- ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-${{ matrix.arch }}
49- ${{ env.LATEST_TAG != '' && format('thirdweb/engine:latest-{0}', matrix.arch) || '' }}
50- cache-from : type=gha,scope=${{ matrix.platform }}
51- cache-to : type=gha,scope=${{ matrix.platform }},mode=max
52- build-args : ENGINE_VERSION=${{ github.event.release.tag_name }}
53-
54- merge-manifests :
55- needs : build
56- runs-on : ubuntu-latest
57- env :
58- LATEST_TAG : ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
59- steps :
60- - name : Set up Docker Buildx
61- uses : docker/setup-buildx-action@v3
62-
63- - name : Login to DockerHub
64- uses : docker/login-action@v3
65- with :
66- username : ${{ secrets.DOCKER_USERNAME }}
67- password : ${{ secrets.DOCKER_PASSWORD }}
68-
69- - name : Create and Push Multi-arch Manifest (release tag)
70- run : |
71- docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }} \
72- ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-amd64 \
73- ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-arm64
74-
75- - name : Inspect release image
76- run : |
77- docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}
78-
79- - name : Create and Push Multi-arch Manifest (latest tag) (if applicable)
80- if : ${{ env.LATEST_TAG != '' }}
81- run : |
82- docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:latest \
83- ${{ env.REGISTRY_IMAGE }}:latest-amd64 \
84- ${{ env.REGISTRY_IMAGE }}:latest-arm64
85-
86- - name : Inspect latest image (if applicable)
87- if : ${{ env.LATEST_TAG != '' }}
88- run : |
1+ name : Tag Based Image Build
2+
3+ on :
4+ release :
5+ types : [created] # This listens to release creation events
6+
7+ env :
8+ REGISTRY_IMAGE : thirdweb/engine
9+
10+ jobs :
11+ build :
12+ runs-on : ${{ matrix.runner }}
13+ strategy :
14+ matrix :
15+ include :
16+ - platform : linux/amd64
17+ runner : ubuntu-latest
18+ arch : amd64
19+ - platform : linux/arm64
20+ runner : ubuntu-24.04-arm64
21+ arch : arm64
22+ env :
23+ LATEST_TAG : ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
24+
25+ steps :
26+ - name : Checkout code
27+ uses : actions/checkout@v3
28+ with :
29+ ref : ${{ github.event.release.target_commitish }}
30+
31+ - name : Set up Docker Buildx
32+ uses : docker/setup-buildx-action@v3
33+
34+ - name : Login to DockerHub
35+ uses : docker/login-action@v3
36+ with :
37+ username : ${{ secrets.DOCKER_USERNAME }}
38+ password : ${{ secrets.DOCKER_PASSWORD }}
39+
40+ - name : Build and Push Docker Image
41+ uses : docker/build-push-action@v6
42+ with :
43+ context : .
44+ target : prod
45+ platforms : ${{ matrix.platform }}
46+ push : true
47+ tags : |
48+ ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-${{ matrix.arch }}
49+ ${{ env.LATEST_TAG != '' && format('thirdweb/engine:latest-{0}', matrix.arch) || '' }}
50+ cache-from : type=gha,scope=${{ matrix.platform }}
51+ cache-to : type=gha,scope=${{ matrix.platform }},mode=max
52+ build-args : ENGINE_VERSION=${{ github.event.release.tag_name }}
53+
54+ merge-manifests :
55+ needs : build
56+ runs-on : ubuntu-latest
57+ env :
58+ LATEST_TAG : ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
59+ steps :
60+ - name : Set up Docker Buildx
61+ uses : docker/setup-buildx-action@v3
62+
63+ - name : Login to DockerHub
64+ uses : docker/login-action@v3
65+ with :
66+ username : ${{ secrets.DOCKER_USERNAME }}
67+ password : ${{ secrets.DOCKER_PASSWORD }}
68+
69+ - name : Create and Push Multi-arch Manifest (release tag)
70+ run : |
71+ docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }} \
72+ ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-amd64 \
73+ ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}-arm64
74+
75+ - name : Inspect release image
76+ run : |
77+ docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ github.event.release.tag_name }}
78+
79+ - name : Create and Push Multi-arch Manifest (latest tag) (if applicable)
80+ if : ${{ env.LATEST_TAG != '' }}
81+ run : |
82+ docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:latest \
83+ ${{ env.REGISTRY_IMAGE }}:latest-amd64 \
84+ ${{ env.REGISTRY_IMAGE }}:latest-arm64
85+
86+ - name : Inspect latest image (if applicable)
87+ if : ${{ env.LATEST_TAG != '' }}
88+ run : |
8989 docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest
0 commit comments