@@ -22,28 +22,47 @@ concurrency:
22
22
23
23
env :
24
24
DOCKER_NAMESPACE : halfshot
25
- PLATFORMS : linux/amd64
26
- PLATFORMS_PUSH : linux/amd64,linux/arm64
27
- # Only push if this is main, otherwise we just want to build
28
- BUILD_FOR_ALL_PLATFORMS : ${{ github.ref == 'refs/heads/main' || github.event_name == 'release' }}
29
25
30
26
jobs :
31
- docker-latest :
27
+ docker-clean-metadata :
32
28
runs-on : ubuntu-latest
29
+ outputs :
30
+ json : ${{ steps.meta.outputs.json }}
31
+ steps :
32
+ - name : Extract metadata (tags, labels) for Docker
33
+ id : meta
34
+ uses : docker/metadata-action@v5
35
+ with :
36
+ tags : |
37
+ type=semver,pattern={{version}}
38
+ type=ref,event=branch
39
+ type=ref,event=pr
40
+ type=raw,value=latest,enable={{is_default_branch}}
41
+ flavor : |
42
+ latest=auto
43
+ images : |
44
+ ${{ env.DOCKER_NAMESPACE }}/matrix-hookshot
45
+ ghcr.io/matrix-org/matrix-hookshot
33
46
47
+ docker-build :
34
48
permissions :
35
49
contents : read
36
50
packages : write
37
51
attestations : write
38
52
id-token : write
53
+ strategy :
54
+ matrix :
55
+ include :
56
+ - os : ubuntu-latest
57
+ arch : amd64
58
+ - os : ubuntu-24.04-arm
59
+ arch : arm64
60
+
61
+ runs-on : ${{ matrix.os }}
39
62
40
63
steps :
41
64
- name : Checkout
42
65
uses : actions/checkout@v4
43
- - name : Set up QEMU
44
- uses : docker/setup-qemu-action@v3
45
- - name : Set up Docker Buildx
46
- uses : docker/setup-buildx-action@v3
47
66
- name : Log in to Docker Hub
48
67
uses : docker/login-action@v3
49
68
with :
55
74
registry : ghcr.io
56
75
username : ${{ github.actor }}
57
76
password : ${{ secrets.GITHUB_TOKEN }}
58
-
59
77
- name : Extract metadata (tags, labels) for Docker
60
78
id : meta
61
79
uses : docker/metadata-action@v5
@@ -65,20 +83,45 @@ jobs:
65
83
type=ref,event=branch
66
84
type=ref,event=pr
67
85
type=raw,value=latest,enable={{is_default_branch}}
86
+ flavor : |
87
+ latest=auto
88
+ suffix=-${{ matrix.arch }},onlatest=true
68
89
images : |
69
90
${{ env.DOCKER_NAMESPACE }}/matrix-hookshot
70
91
ghcr.io/matrix-org/matrix-hookshot
71
-
92
+
72
93
- name : Build and push Docker images
73
- id : push
74
94
uses : docker/build-push-action@v6
75
95
with :
76
- context : .
77
- # arm64 builds OOM without the git fetch setting. c.f.
78
- # https://github.com/rust-lang/cargo/issues/10583
79
- build-args : |
80
- CARGO_NET_GIT_FETCH_WITH_CLI=true
81
- platforms : ${{ (env.BUILD_FOR_ALL_PLATFORMS == 'true' && env.PLATFORMS_PUSH) || env.PLATFORMS }}
82
96
push : true
83
97
tags : ${{ steps.meta.outputs.tags }}
84
98
labels : ${{ steps.meta.outputs.labels }}
99
+
100
+ docker-manifest :
101
+ needs :
102
+ - docker-build
103
+ - docker-clean-metadata
104
+ runs-on : ubuntu-latest
105
+
106
+ strategy :
107
+ matrix :
108
+ image : ${{ fromJson(needs.docker-clean-metadata.outputs.json).tags }}
109
+
110
+ steps :
111
+ - name : Log in to Docker Hub
112
+ uses : docker/login-action@v3
113
+ with :
114
+ username : ${{ secrets.DOCKER_HUB_USERNAME }}
115
+ password : ${{ secrets.DOCKER_HUB_TOKEN }}
116
+
117
+ - name : Log in to the GitHub Container registry
118
+ uses : docker/login-action@v3
119
+ with :
120
+ registry : ghcr.io
121
+ username : ${{ github.actor }}
122
+ password : ${{ secrets.GITHUB_TOKEN }}
123
+
124
+ - name : Create and push manifest
125
+ run : |
126
+ docker manifest create ${{ matrix.image }} ${{ matrix.image }}-amd64 ${{ matrix.image }}-arm64
127
+ docker manifest push ${{ matrix.image }}
0 commit comments