15
15
IMAGE_NAME : ${{ github.repository }}
16
16
17
17
jobs :
18
- container :
18
+
19
+ build-amd64 :
19
20
name : Container
20
- runs-on : ubuntu-22.04
21
+ runs-on : ubuntu-24.04${{ matrix.runner-suffix }}
22
+ strategy :
23
+ matrix :
24
+ include :
25
+ - platform : amd64
26
+ runner-suffix :
21
27
permissions :
22
28
packages : write
23
29
steps :
@@ -48,13 +54,72 @@ jobs:
48
54
uses : docker/metadata-action@v5
49
55
with :
50
56
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
57
+ flavor : suffix=--${{ matrix.platform }},latest=false
51
58
labels : |
52
59
org.opencontainers.image.revision=${{ steps.gitdescribe.outputs.ver }}
53
60
org.opencontainers.image.licenses=GPL-2.0
54
61
org.opencontainers.image.vendor=ProcessOne
55
62
56
- - name : Set up QEMU
57
- uses : docker/setup-qemu-action@v3
63
+ - name : Set up Docker Buildx
64
+ uses : docker/setup-buildx-action@v3
65
+
66
+ - name : Build and push Docker image
67
+ uses : docker/build-push-action@v6
68
+ with :
69
+ build-args : |
70
+ VERSION=${{ steps.gitdescribe.outputs.ver }}
71
+ cache-from : type=gha
72
+ cache-to : type=gha,mode=max
73
+ context : .
74
+ file : .github/container/Dockerfile
75
+ labels : ${{ steps.meta.outputs.labels }}
76
+ platforms : linux/${{ matrix.platform }}
77
+ push : true
78
+ tags : ${{ steps.meta.outputs.tags }}
79
+
80
+ build-arm64 :
81
+ name : Container
82
+ runs-on : ubuntu-24.04${{ matrix.runner-suffix }}
83
+ strategy :
84
+ matrix :
85
+ include :
86
+ - platform : arm64
87
+ runner-suffix : -arm
88
+ permissions :
89
+ packages : write
90
+ steps :
91
+ - name : Check out repository code
92
+ uses : actions/checkout@v5
93
+ with :
94
+ fetch-depth : 0
95
+
96
+ - name : Checkout ejabberd-contrib
97
+ uses : actions/checkout@v5
98
+ with :
99
+ repository : processone/ejabberd-contrib
100
+ path : .ejabberd-modules/sources/ejabberd-contrib
101
+
102
+ - name : Log in to the Container registry
103
+ uses : docker/login-action@v3
104
+ with :
105
+ registry : ${{ env.REGISTRY }}
106
+ username : ${{ github.actor }}
107
+ password : ${{ secrets.GITHUB_TOKEN }}
108
+
109
+ - name : Get git describe
110
+ id : gitdescribe
111
+ run : echo "ver=$(git describe --tags)" >> $GITHUB_OUTPUT
112
+
113
+ - name : Extract metadata (tags, labels) for Docker
114
+ id : meta
115
+ uses : docker/metadata-action@v5
116
+ with :
117
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
118
+ flavor : suffix=--${{ matrix.platform }},latest=false
119
+ labels : |
120
+ org.opencontainers.image.revision=${{ steps.gitdescribe.outputs.ver }}
121
+ org.opencontainers.image.licenses=GPL-2.0
122
+ org.opencontainers.image.vendor=ProcessOne
58
123
59
124
- name : Set up Docker Buildx
60
125
uses : docker/setup-buildx-action@v3
@@ -69,6 +134,40 @@ jobs:
69
134
context : .
70
135
file : .github/container/Dockerfile
71
136
labels : ${{ steps.meta.outputs.labels }}
72
- platforms : linux/amd64,linux/arm64
137
+ platforms : linux/${{ matrix.platform }}
73
138
push : true
74
139
tags : ${{ steps.meta.outputs.tags }}
140
+
141
+ merge :
142
+ needs :
143
+ - build-amd64
144
+ - build-arm64
145
+ runs-on : ubuntu-24.04
146
+ outputs :
147
+ image-uri : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.merge.outputs.digest }}
148
+ steps :
149
+ - uses : docker/login-action@v3
150
+ with :
151
+ registry : ghcr.io
152
+ username : ${{ github.actor }}
153
+ password : ${{ secrets.GITHUB_TOKEN }}
154
+ - uses : docker/metadata-action@v5
155
+ id : metadata
156
+ with :
157
+ images : ghcr.io/${{ github.repository }}
158
+ - uses : int128/docker-manifest-create-action@v2
159
+ id : merge
160
+ with :
161
+ index-annotations : ${{ steps.metadata.outputs.labels }}
162
+ tags : ${{ steps.metadata.outputs.tags }}
163
+ sources : |
164
+ ${{ steps.metadata.outputs.tags }}--amd64
165
+ ${{ steps.metadata.outputs.tags }}--arm64
166
+ - uses : dataaxiom/ghcr-cleanup-action@v1
167
+ with :
168
+ dry-run : true
169
+ delete-tags : ' *--a??64'
170
+ delete-untagged : true
171
+ delete-ghost-images : true
172
+ delete-partial-images : true
173
+ delete-orphaned-images : true
0 commit comments