6
6
7
7
jobs :
8
8
buildImageForNewTag :
9
- runs-on : ubuntu-latest-32
10
- # Set environment variables
9
+ runs-on : ubuntu-latest
10
+ strategy :
11
+ matrix :
12
+ platform : [linux/amd64, linux/arm64]
11
13
env :
12
14
LATEST_TAG : ${{ (github.event.release.target_commitish == 'main') && 'thirdweb/engine:latest' || '' }}
13
15
14
16
steps :
15
17
- name : Checkout code
16
18
uses : actions/checkout@v2
17
19
with :
18
- # Fetches the branch at which the release was made
19
20
ref : ${{ github.event.release.target_commitish }}
20
21
21
22
- name : Set up Docker Buildx
@@ -32,12 +33,41 @@ jobs:
32
33
with :
33
34
context : .
34
35
target : prod
35
- platforms : linux/amd64,linux/arm64
36
+ platforms : ${{ matrix.platform }}
36
37
push : true
37
- cache-from : type=gha
38
- cache-to : type=gha,mode=max
39
- tags : |
40
- thirdweb/engine:${{ github.event.release.tag_name }}
41
- ${{ env.LATEST_TAG }}
38
+ cache-from : |
39
+ type=gha,scope=${{ matrix.platform }}
40
+ type=registry,ref=thirdweb/engine:buildcache-${{ matrix.platform }}
41
+ cache-to : |
42
+ type=gha,scope=${{ matrix.platform }},mode=max
43
+ type=registry,ref=thirdweb/engine:buildcache-${{ matrix.platform }},mode=max
44
+ tags : thirdweb/engine:${{ github.event.release.tag_name }}-${{ matrix.platform }}
42
45
build-args : |
43
46
ENGINE_VERSION=${{ github.event.release.tag_name }}
47
+
48
+ merge-manifests :
49
+ needs : buildImageForNewTag
50
+ runs-on : ubuntu-latest
51
+ env :
52
+ LATEST_TAG : ${{ (github.event.release.target_commitish == 'main') && 'thirdweb/engine:latest' || '' }}
53
+ steps :
54
+ - name : Login to DockerHub
55
+ uses : docker/login-action@v1
56
+ with :
57
+ username : ${{ secrets.DOCKER_USERNAME }}
58
+ password : ${{ secrets.DOCKER_PASSWORD }}
59
+
60
+ - name : Create and Push Multi-arch Manifest
61
+ run : |
62
+ docker manifest create thirdweb/engine:${{ github.event.release.tag_name }} \
63
+ thirdweb/engine:${{ github.event.release.tag_name }}-linux/amd64 \
64
+ thirdweb/engine:${{ github.event.release.tag_name }}-linux/arm64
65
+ docker manifest push thirdweb/engine:${{ github.event.release.tag_name }}
66
+
67
+ - name : Create and Push Latest Tag (if applicable)
68
+ if : ${{ env.LATEST_TAG != '' }}
69
+ run : |
70
+ docker manifest create thirdweb/engine:latest \
71
+ thirdweb/engine:${{ github.event.release.tag_name }}-linux/amd64 \
72
+ thirdweb/engine:${{ github.event.release.tag_name }}-linux/arm64
73
+ docker manifest push thirdweb/engine:latest
0 commit comments