Skip to content

Commit

Permalink
ci: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jobulcke committed Aug 16, 2024
1 parent dedd245 commit c9278e7
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/[email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
Expand All @@ -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}

0 comments on commit c9278e7

Please sign in to comment.