Skip to content

Commit 6238d92

Browse files
committed
add multiplatform push
1 parent 46603d6 commit 6238d92

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/docker.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,30 @@ jobs:
6262
echo VERSION=$VERSION
6363
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
6464
docker push $IMAGE_ID:$VERSION
65+
66+
push-multiplatform:
67+
name: Push multi platform
68+
needs: build-linux
69+
runs-on: ubuntu-latest
70+
if: ${{ github.event_name != 'pull_request' }}
71+
steps:
72+
- name: Log in to registry
73+
if: ${{ github.event_name != 'pull_request' }}
74+
# This is where you will update the PAT to GITHUB_TOKEN
75+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
76+
77+
- name: Get images
78+
shell: bash
79+
run: |
80+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
81+
82+
# Change all uppercase to lowercase
83+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
84+
# Strip git ref prefix from version
85+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
86+
# Strip "v" prefix from tag name
87+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
88+
# Use Docker `latest` tag convention
89+
[ "$VERSION" == "main" ] && VERSION=latest
90+
docker manifest create $IMAGE_ID:$VERSION $IMAGE_ID:$VERSION-arm64 $IMAGE_ID:$VERSION-x86_64
91+
docker manifest push $IMAGE_ID:$VERSION

0 commit comments

Comments
 (0)