Skip to content

Commit

Permalink
Merge pull request #51 from ykulazhenkov/image-push-fix
Browse files Browse the repository at this point in the history
Fix multiarch image push logic in github actions
  • Loading branch information
adrianchiris committed Mar 28, 2023
2 parents aeed126 + 63dfef7 commit c2985bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push to GitHub Container Registry
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
push: true
tags: |
Expand Down Expand Up @@ -61,10 +61,4 @@ jobs:
env:
REPOSITORY: ghcr.io/${{ steps.repo_name.outputs.repository }}
run: |
# Get artifacts from previous steps
docker pull ${{ env.REPOSITORY }}:latest-amd64
# Create and update manifest
docker manifest create ${{ env.REPOSITORY }}:latest ${{ env.REPOSITORY }}:latest-amd64
docker manifest annotate ${{ env.REPOSITORY }}:latest ${{ env.REPOSITORY }}:latest-amd64 --arch amd64
# Push manifest
docker manifest push ${{ env.REPOSITORY }}:latest
docker buildx imagetools create -t ${{ env.REPOSITORY }}:latest ${{ env.REPOSITORY }}:latest-amd64
19 changes: 7 additions & 12 deletions .github/workflows/push-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ jobs:
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ steps.repo_name.outputs.repository }}
tags: |
type=ref,event=tag
flavor: |
latest=false
- name: Push container image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand All @@ -59,6 +61,8 @@ jobs:
id: docker_meta
uses: docker/metadata-action@v4
with:
tags: |
type=ref,event=tag
images: ghcr.io/${{ steps.repo_name.outputs.repository }}
flavor: |
latest=false
Expand All @@ -74,14 +78,5 @@ jobs:
env:
REPOSITORY: ghcr.io/${{ steps.repo_name.outputs.repository }}
run: |
# Get artifacts from previous steps
docker pull ${{ steps.docker_meta.outputs.tags }}-amd64
docker pull ${{ env.REPOSITORY }}:stable-amd64
# Create and update manifests
docker manifest create ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-amd64
docker manifest annotate ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-amd64 --arch amd64
docker manifest create ${{ env.REPOSITORY }}:stable ${{ env.REPOSITORY }}:stable-amd64
docker manifest annotate ${{ env.REPOSITORY }}:stable ${{ env.REPOSITORY }}:stable-amd64 --arch amd64
# push manifests
docker manifest push ${{ steps.docker_meta.outputs.tags }}
docker manifest push ${{ env.REPOSITORY }}:stable
docker buildx imagetools create -t ${{ env.REPOSITORY }}:stable ${{ env.REPOSITORY }}:stable-amd64
docker buildx imagetools create -t ${{ steps.docker_meta.outputs.tags }} ${{ steps.docker_meta.outputs.tags }}-amd64

0 comments on commit c2985bf

Please sign in to comment.