Skip to content

Commit

Permalink
fix: prevent incorrect image generation
Browse files Browse the repository at this point in the history
  • Loading branch information
oae committed Oct 28, 2022
1 parent 73ef621 commit 31075fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ jobs:

release-please:
outputs:
release_tag: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
release_major: ${{ steps.release.outputs.major }}
release_minor: ${{ steps.release.outputs.minor }}
release_patch: ${{ steps.release.outputs.patch }}
release_created: ${{ steps.release.outputs.release_created }}
needs: check
runs-on: ubuntu-latest
Expand All @@ -58,9 +60,6 @@ jobs:

build-and-push:
needs: release-please
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -69,7 +68,7 @@ jobs:

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: ${{ matrix.platform == 'linux/arm64' && needs.release-please.outputs.release_created }}
if: ${{ needs.release-please.outputs.release_created }}

- name: Set up Docker Build
uses: docker/setup-buildx-action@v2
Expand All @@ -94,9 +93,9 @@ jobs:
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ matrix.platform }}-buildx-${{ github.sha }}
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.platform }}-buildx-
${{ runner.os }}-buildx-
if: ${{ needs.release-please.outputs.release_created }}

- name: Build
Expand All @@ -105,14 +104,18 @@ jobs:
context: .
file: docker/Dockerfile
push: ${{ needs.release-please.outputs.release_created }}
platforms: ${{ matrix.platform }}
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/kaizoku:latest
${{ secrets.DOCKERHUB_USERNAME }}/kaizoku:v${{ needs.release-please.outputs.release_tag }}
${{ secrets.DOCKERHUB_USERNAME }}/kaizoku:v${{ needs.release-please.outputs.release_major }}
${{ secrets.DOCKERHUB_USERNAME }}/kaizoku:v${{ needs.release-please.outputs.release_major }}.${{ needs.release-please.outputs.release_minor }}
${{ secrets.DOCKERHUB_USERNAME }}/kaizoku:v${{ needs.release-please.outputs.release_major }}.${{ needs.release-please.outputs.release_minor }}.${{ needs.release-please.outputs.release_patch }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:v${{ needs.release-please.outputs.release_tag }}
ghcr.io/${{ github.repository }}:v${{ needs.release-please.outputs.release_major }}
ghcr.io/${{ github.repository }}:v${{ needs.release-please.outputs.release_major }}.${{ needs.release-please.outputs.release_minor }}
ghcr.io/${{ github.repository }}:v${{ needs.release-please.outputs.release_major }}.${{ needs.release-please.outputs.release_minor }}.${{ needs.release-please.outputs.release_patch }}
if: ${{ needs.release-please.outputs.release_created }}

- name: Move cache
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ WORKDIR /tmp

RUN \
if [ "$(uname -m)" = "x86_64" ] ; then \
curl -L "https://github.com/metafates/mangal/releases/download/v3.14.0/mangal_3.14.0_Linux_x86_64.tar.gz" -o mangal.tar.gz ;\
curl -L "https://github.com/metafates/mangal/releases/download/v3.14.2/mangal_3.14.2_Linux_x86_64.tar.gz" -o mangal.tar.gz ;\
elif [ "$(uname -m)" = "armv6l" ] ; then \
curl -L "https://github.com/metafates/mangal/releases/download/v3.14.0/mangal_3.14.0_Linux_armv6.tar.gz" -o mangal.tar.gz ;\
curl -L "https://github.com/metafates/mangal/releases/download/v3.14.2/mangal_3.14.2_Linux_armv6.tar.gz" -o mangal.tar.gz ;\
elif [ "$(uname -m)" = "i386" ] ; then \
curl -L "https://github.com/metafates/mangal/releases/download/v3.14.0/mangal_3.14.0_Linux_i386.tar.gz" -o mangal.tar.gz ;\
curl -L "https://github.com/metafates/mangal/releases/download/v3.14.2/mangal_3.14.2_Linux_i386.tar.gz" -o mangal.tar.gz ;\
elif [ "$(uname -m)" = "aarch64" ] ; then \
curl -L "https://github.com/metafates/mangal/releases/download/v3.14.0/mangal_3.14.0_Linux_arm64.tar.gz" -o mangal.tar.gz ;\
curl -L "https://github.com/metafates/mangal/releases/download/v3.14.2/mangal_3.14.2_Linux_arm64.tar.gz" -o mangal.tar.gz ;\
fi
RUN tar xf mangal.tar.gz
RUN mv mangal /usr/bin/mangal
Expand Down

0 comments on commit 31075fd

Please sign in to comment.