Skip to content

Commit f6811d3

Browse files
Optimizing image upload process (#105)
1 parent d044add commit f6811d3

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

.github/workflows/Build.yml

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ jobs:
193193
- name: Setup Docker Buildx
194194
uses: docker/setup-buildx-action@v3
195195
- name: Login to DockerHub
196+
if: ${{ github.repository_owner == 'rust-cross' }}
196197
uses: docker/login-action@v3
197198
with:
198199
username: ${{ secrets.DOCKER_USERNAME }}
@@ -251,6 +252,30 @@ jobs:
251252
252253
cat ghcr-manifest.yaml
253254
./manifest-tool push from-spec ghcr-manifest.yaml
255+
256+
if [ "${{ matrix.platform.arch }}" != "armv7l" ]; then
257+
exit 0
258+
fi
259+
260+
echo "image: ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:armv7
261+
manifests:" > ghcr-manifest-armv7.yaml
262+
263+
if docker manifest inspect ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-amd64 > /dev/null; then
264+
echo " - image: ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-amd64
265+
platform:
266+
architecture: amd64
267+
os: linux" >> ghcr-manifest-armv7.yaml
268+
fi
269+
270+
if docker manifest inspect ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-arm64 > /dev/null; then
271+
echo " - image: ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-arm64
272+
platform:
273+
architecture: arm64
274+
os: linux" >> ghcr-manifest-armv7.yaml
275+
fi
276+
277+
cat ghcr-manifest-armv7.yaml
278+
./manifest-tool push from-spec ghcr-manifest-armv7.yaml
254279
- name: Sync images to Docker Hub
255280
if: ${{ github.repository_owner == 'rust-cross' }}
256281
env:
@@ -278,52 +303,30 @@ jobs:
278303
279304
cat dockerhub-manifest.yaml
280305
./manifest-tool push from-spec dockerhub-manifest.yaml
281-
- name: Alias armv7l to armv7
282-
if: matrix.platform.arch == 'armv7l'
283-
env:
284-
DOCKER_CLI_EXPERIMENTAL: enabled
285-
run: |
286-
set -e
287-
288-
echo "image: ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:armv7
289-
manifests:" > ghcr-manifest.yaml
290306
291-
if docker manifest inspect ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-amd64 > /dev/null; then
292-
echo " - image: ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-amd64
293-
platform:
294-
architecture: amd64
295-
os: linux" >> ghcr-manifest.yaml
307+
if [ "${{ matrix.platform.arch }}" != "armv7l" ]; then
308+
exit 0
296309
fi
297-
298-
if docker manifest inspect ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-arm64 > /dev/null; then
299-
echo " - image: ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-arm64
300-
platform:
301-
architecture: arm64
302-
os: linux" >> ghcr-manifest.yaml
303-
fi
304-
305-
cat ghcr-manifest.yaml
306-
./manifest-tool push from-spec ghcr-manifest.yaml
307-
310+
308311
echo "image: ${{ secrets.DOCKER_USERNAME }}/${{ matrix.platform.manylinux }}-cross:armv7
309-
manifests:" > dockerhub-manifest.yaml
312+
manifests:" > dockerhub-manifest-armv7l.yaml
310313
311314
if docker manifest inspect ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-amd64 > /dev/null; then
312315
echo " - image: ${{ secrets.DOCKER_USERNAME }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-amd64
313316
platform:
314317
architecture: amd64
315-
os: linux" >> dockerhub-manifest.yaml
318+
os: linux" >> dockerhub-manifest-armv7l.yaml
316319
fi
317320
318321
if docker manifest inspect ghcr.io/${{ github.repository_owner }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-arm64 > /dev/null; then
319322
echo " - image: ${{ secrets.DOCKER_USERNAME }}/${{ matrix.platform.manylinux }}-cross:${{ matrix.platform.arch }}-arm64
320323
platform:
321324
architecture: arm64
322-
os: linux" >> dockerhub-manifest.yaml
325+
os: linux" >> dockerhub-manifest-armv7l.yaml
323326
fi
324327
325-
cat dockerhub-manifest.yaml
326-
./manifest-tool push from-spec dockerhub-manifest.yaml
328+
cat dockerhub-manifest-armv7l.yaml
329+
./manifest-tool push from-spec dockerhub-manifest-armv7l.yaml
327330
328331
conclusion:
329332
needs: [setup, build]

0 commit comments

Comments
 (0)