44 release :
55 types : [created] # This listens to release creation events
66
7+ env :
8+ REGISTRY_IMAGE : thirdweb/engine
9+
710jobs :
8- buildImageForNewTag :
9- runs-on : ubuntu-latest-32
10- # Set environment variables
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
1122 env :
12- LATEST_TAG : ${{ ( github.event.release.target_commitish == 'main') && 'thirdweb/engine:latest' || '' }}
23+ LATEST_TAG : ${{ github.event.release.target_commitish == 'main' && 'thirdweb/engine:latest' || '' }}
1324
1425 steps :
15- - name : Check Disk Space Before Build
16- run : df -h
17-
18- - name : Docker Prune
19- run : docker system prune -af
20-
2126 - name : Checkout code
22- uses : actions/checkout@v2
27+ uses : actions/checkout@v3
2328 with :
24- # Fetches the branch at which the release was made
2529 ref : ${{ github.event.release.target_commitish }}
2630
2731 - name : Set up Docker Buildx
28- uses : docker/setup-buildx-action@v1
32+ uses : docker/setup-buildx-action@v3
2933
3034 - name : Login to DockerHub
31- uses : docker/login-action@v1
35+ uses : docker/login-action@v3
3236 with :
3337 username : ${{ secrets.DOCKER_USERNAME }}
3438 password : ${{ secrets.DOCKER_PASSWORD }}
3539
3640 - name : Build and Push Docker Image
37- uses : docker/build-push-action@v2
41+ uses : docker/build-push-action@v6
3842 with :
3943 context : .
4044 target : prod
41- platforms : linux/amd64,linux/arm64
45+ platforms : ${{ matrix.platform }}
4246 push : true
4347 tags : |
44- thirdweb/engine:${{ github.event.release.tag_name }}
45- ${{ env.LATEST_TAG }}
46- build-args : |
47- ENGINE_VERSION=${{ github.event.release.tag_name }}
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 }}
4878
49- - name : Check Disk Space After Build
50- run : df -h
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 : |
89+ docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest
0 commit comments