From 7305791586bb9f40b5aa77d0ccbb9d400eab0488 Mon Sep 17 00:00:00 2001 From: Rory Z <16801068+Rory-Z@users.noreply.github.com> Date: Thu, 25 Jul 2024 10:16:43 +0800 Subject: [PATCH] ci: push multi arch image to ghcr when release Signed-off-by: Rory Z <16801068+Rory-Z@users.noreply.github.com> --- .github/workflows/cts.yaml | 7 ++----- .github/workflows/release.yml | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cts.yaml b/.github/workflows/cts.yaml index 9d5d9182..05d5047b 100644 --- a/.github/workflows/cts.yaml +++ b/.github/workflows/cts.yaml @@ -4,9 +4,6 @@ on: workflow_dispatch: schedule: - cron: '0 */6 * * *' - push: - tags: - - "*" jobs: test: @@ -74,7 +71,7 @@ jobs: - uses: docker/metadata-action@v5 id: meta with: - images: ghcr.io/${{ github.repository }} + images: ghcr.io/${{ github.repository_owner }}/emqx-operator-controller flavor: | latest=true tags: | @@ -136,7 +133,7 @@ jobs: timeout-minutes: 5 uses: ./.github/actions/deploy-operator with: - repository: ghcr.io/${{ github.repository }} + repository: ghcr.io/${{ github.repository_owner }}/emqx-operator-controller tag: ${{ github.ref_name }} - name: Deploy emqx timeout-minutes: 5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7b22a60..ab4d78e8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,21 +28,27 @@ jobs: fi - uses: docker/setup-qemu-action@v3 - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + - uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} - uses: docker/metadata-action@v5 id: meta with: - images: ${{ github.repository_owner }}/emqx-operator-controller + images: | + ${{ github.repository_owner }}/emqx-operator-controller + ghcr.io/${{ github.repository_owner }}/emqx-operator-controller tags: | type=ref,event=branch type=ref,event=pr type=ref,event=tag type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - - uses: docker/login-action@v3 - if: startsWith(github.ref, 'refs/tags/') - with: - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_TOKEN }} - uses: docker/build-push-action@v5 with: platforms: linux/amd64,linux/arm64,linux/arm/v7 @@ -65,7 +71,6 @@ jobs: echo "::set-output name=prerelease::true" fi - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') with: prerelease: ${{ steps.prerelease.outputs.prerelease }} generate_release_notes: true