@@ -60,10 +60,12 @@ jobs:
6060 - name : Test
6161 run : cargo test
6262
63- # Publish latest and releases (e.g. tags with semver).
64- docker-build-push-release :
63+ docker-build-push :
6564 needs : [ test ]
66- runs-on : ubuntu-latest
65+ strategy :
66+ matrix :
67+ platform : ["amd64", "arm64"]
68+ runs-on : ${{ matrix.platform == 'amd64' && 'ubuntu-22.04' || 'ubuntu-22.04-arm' }}
6769 permissions :
6870 packages : write # push to ghcr.io
6971 if : startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
7678 images : |
7779 ghcr.io/${{ github.repository_owner }}/horust
7880 federicoponzi/horust
81+ flavor : |
82+ latest=false
83+ suffix=-${{ matrix.platform }}
7984 tags : |
80- type=sha
81- type=ref,event=branch
8285 type=semver,pattern={{version}}
8386 type=semver,pattern={{major}}.{{minor}}
8487
@@ -103,19 +106,61 @@ jobs:
103106 - name : Build and push images
104107 uses : docker/build-push-action@v6
105108 with :
106- platforms : linux/amd64,linux/arm64
109+ platforms : linux/${{ matrix.platform }}
107110 labels : ${{ steps.meta.outputs.labels }}
108111 tags : ${{ steps.meta.outputs.tags }}
109112 cache-from : type=gha
110113 cache-to : type=gha,mode=max
111114 push : true
115+ provenance : false # avoid push manifest-list
116+
117+ # amend the platform tag for docker images
118+ docker-manifests :
119+ needs : ["docker-build-push"]
120+ runs-on : ubuntu-latest
121+ if : startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
122+ permissions :
123+ packages : write # push to ghcr.io
124+ steps :
125+ - name : Login to Docker Hub
126+ uses : docker/login-action@v3
127+ with :
128+ username : ${{ secrets.DOCKER_USERNAME }}
129+ password : ${{ secrets.DOCKER_PASSWORD }}
130+ - name : Login to GHCR
131+ uses : docker/login-action@v3
132+ with :
133+ registry : ghcr.io
134+ username : ${{ github.repository_owner }}
135+ password : ${{ secrets.GITHUB_TOKEN }}
136+ - name : Get the semver
137+ id : semver
138+ run : |
139+ VERSION="${{ github.ref_name }}"
140+ SEMVER="${VERSION#v}"
141+ echo "semver=${SEMVER}" >> "$GITHUB_OUTPUT"
142+ - name : Create manifests
143+ run : |
144+ AMD_TAG=${{ steps.semver.outputs.semver }}-amd64
145+ ARM_TAG=${{ steps.semver.outputs.semver }}-arm64
146+ SEMVER=${{ steps.semver.outputs.semver }}
147+ docker manifest create \
148+ ghcr.io/${{ github.repository_owner }}/horust:${SEMVER} \
149+ --amend ghcr.io/${{ github.repository_owner }}/horust:${AMD_TAG} \
150+ --amend ghcr.io/${{ github.repository_owner }}/horust:${ARM_TAG}
151+ docker manifest push ghcr.io/${{ github.repository_owner }}/horust:${SEMVER}
152+ docker manifest create \
153+ federicoponzi/horust:${SEMVER} \
154+ --amend federicoponzi/horust:${AMD_TAG} \
155+ --amend federicoponzi/horust:${ARM_TAG}
156+ docker manifest push federicoponzi/horust:${SEMVER}
112157
113158 # # This will create a new release in github/releases page. It will run only for tags with semver format.
114159 create-release :
115160 name : deploy
116161 needs : [ test ]
117162 if : startsWith(github.ref, 'refs/tags/')
118- runs-on : ubuntu-latest
163+ runs-on : ubuntu-22.04 # glibc 2.35
119164 strategy :
120165 matrix :
121166 target :
0 commit comments