From 28b2b06f41f7ba7075a3d8dea39cd087053d002a Mon Sep 17 00:00:00 2001 From: Scott Gress Date: Tue, 4 Feb 2025 12:50:55 -0600 Subject: [PATCH] use tag rather than commit sha --- .github/workflows/goreleaser-fleet.yaml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/goreleaser-fleet.yaml b/.github/workflows/goreleaser-fleet.yaml index 09f138d70850..8946a560bf9d 100644 --- a/.github/workflows/goreleaser-fleet.yaml +++ b/.github/workflows/goreleaser-fleet.yaml @@ -95,10 +95,10 @@ jobs: with: subject-path: "dist/**" - # Get the commit hash so we can get image digests - - name: Get the short commit hash - id: commit - run: echo "short_commit=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + - name: Get tag + run: | + echo "TAG=$(git describe --tags | sed -e "s/^fleet-//")" >> $GITHUB_OUTPUT + id: docker # Get the image digests from the goreleaser artifacts # Adapted from https://github.com/goreleaser/goreleaser/issues/4852#issuecomment-2122790132 @@ -106,8 +106,8 @@ jobs: continue-on-error: true id: image_digests run: | - echo "digest_fleet=$(cat ./dist/artifacts.json | jq -r '.[]|select(.type == "Published Docker Image" and (.name | contains("fleetdm/fleet:${{ steps.commit.outputs.short_commit }}"))) | select(. != null)|.extra.Digest')" >> "$GITHUB_OUTPUT" - echo "digest_fleetctl=$(cat ./dist/artifacts.json | jq -r '.[]|select(.type == "Published Docker Image" and (.name | contains("fleetdm/fleetctl:${{ steps.commit.outputs.short_commit }}"))) | select(. != null)|.extra.Digest')" >> "$GITHUB_OUTPUT" + echo "digest_fleet=$(cat ./dist/artifacts.json | jq -r '.[]|select(.type == "Published Docker Image" and (.name | contains("fleetdm/fleet:${{ steps.docker.outputs.tag }}"))) | select(. != null)|.extra.Digest')" >> "$GITHUB_OUTPUT" + echo "digest_fleetctl=$(cat ./dist/artifacts.json | jq -r '.[]|select(.type == "Published Docker Image" and (.name | contains("fleetdm/fleetctl:${{ steps.docker.outputs.tag }}"))) | select(. != null)|.extra.Digest')" >> "$GITHUB_OUTPUT" - name: Attest Fleet image uses: actions/attest-build-provenance@619dbb2e03e0189af0c55118e7d3c5e129e99726 # v2.0 @@ -125,11 +125,6 @@ jobs: subject-name: "fleetdm/fleetctl" push-to-registry: true - - name: Get tag - run: | - echo "TAG=$(git describe --tags | sed -e "s/^fleet-//")" >> $GITHUB_OUTPUT - id: docker - - name: List tags for push run: | echo "The following TAGs are to be pushed: ${{ steps.docker.outputs.TAG }}"