From dced8e09556f880d3b5e7da9ffdcc15250f6ca23 Mon Sep 17 00:00:00 2001 From: Aljoscha Poertner Date: Tue, 13 Feb 2024 08:22:43 +0100 Subject: [PATCH 1/3] ci(release): run on branches but create release only on tags Signed-off-by: Aljoscha Poertner --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c491c8f..652df33 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,8 @@ on: push: tags: - v*.*.* + branches: + - ci/** env: REGISTRY: ghcr.io @@ -81,6 +83,7 @@ jobs: run: | convco changelog $(git tag --list --sort=version:refname | tail -2 | head -1 )..$(git tag --list --sort=version:refname | tail -1 ) > CHANGELOG.md - name: Create Github release + if: ${{ startsWith(github.ref, 'refs/tags/') }} uses: ncipollo/release-action@v1 with: artifacts: "checksums.txt" From d2ab5832445073c7a2e1c765cfe496cb1fff72fb Mon Sep 17 00:00:00 2001 From: Aljoscha Poertner Date: Tue, 13 Feb 2024 08:52:15 +0100 Subject: [PATCH 2/3] ci(release): use id in digest upload Signed-off-by: Aljoscha Poertner --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 652df33..38b7c2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -96,8 +96,8 @@ jobs: fail-fast: false matrix: recipe: - - { target: aarch64-unknown-linux-gnu, platform: linux/arm64 } - - { target: x86_64-unknown-linux-gnu, platform: linux/amd64 } + - { id: 0, target: aarch64-unknown-linux-gnu, platform: linux/arm64 } + - { id: 1, target: x86_64-unknown-linux-gnu, platform: linux/amd64 } permissions: contents: read packages: write @@ -136,7 +136,7 @@ jobs: - name: Upload digest uses: actions/upload-artifact@v4 with: - name: digests-${{ matrix.recipe }} + name: digests-${{ matrix.recipe.id }} path: /tmp/digests/* if-no-files-found: error retention-days: 1 From cb069fa0b66946ac3e607675544c75c9f7a19a37 Mon Sep 17 00:00:00 2001 From: Aljoscha Poertner Date: Tue, 13 Feb 2024 10:03:42 +0100 Subject: [PATCH 3/3] ci(release): run push in dry-run mode when running on branch Signed-off-by: Aljoscha Poertner --- .github/workflows/release.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 38b7c2b..265a7f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -170,7 +170,14 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Create manifest list and push + if: ${{ startsWith(github.ref, 'refs/tags/') }} working-directory: /tmp/digests run: | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ $(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *) + - name: Create manifest list and push in dry-run mode + if: ${{ ! startsWith(github.ref, 'refs/tags/') }} + working-directory: /tmp/digests + run: | + docker buildx imagetools create --dry-run $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)