From c9278e7becc8450319dc4ba93c5784fb61a33896 Mon Sep 17 00:00:00 2001 From: Jonas Bulcke Date: Fri, 16 Aug 2024 21:13:18 +0200 Subject: [PATCH] ci: improvements --- .github/workflows/docker-publish.yml | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 5c40577..64179d4 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -54,7 +54,7 @@ jobs: run: | export VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) echo "IMAGE_TAG=$VERSION" >> $GITHUB_ENV - if [[ "${{ env.version }}" != *"SNAPSHOT"* ]]; then + if [[ "${{ env.IMAGE_TAG }}" != *"SNAPSHOT"* ]]; then echo "LATEST=latest" >> $GITHUB_ENV fi @@ -83,7 +83,7 @@ jobs: # https://github.com/docker/build-push-action - name: Build and push Docker image id: build-and-push - uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + uses: docker/build-push-action@v5.0.0 with: context: . push: ${{ github.event_name != 'pull_request' }} @@ -92,17 +92,4 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max - # Sign the resulting Docker image digest except on PRs. - # This will only write to the public Rekor transparency log when the Docker - # repository is public to avoid leaking data. If you would like to publish - # transparency data even for private images, pass --force to cosign below. - # https://github.com/sigstore/cosign - - name: Sign the published Docker image - if: ${{ github.event_name != 'pull_request' }} - env: - # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable - TAGS: ${{ steps.meta.outputs.tags }} - DIGEST: ${{ steps.build-and-push.outputs.digest }} - # This step uses the identity token to provision an ephemeral certificate - # against the sigstore community Fulcio instance. - run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} +