From 3f4cf72f9c13d0a1de58a37dd4b861c9f545e90d Mon Sep 17 00:00:00 2001 From: Dragos Campean Date: Mon, 19 Feb 2024 13:14:18 +0200 Subject: [PATCH] Image tag to lowercase --- .github/workflows/main.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d2377c6..7c92e16 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,13 +34,21 @@ jobs: # Login against a Docker registry except on PR # https://github.com/docker/login-action - # - name: Log into registry ${{ env.REGISTRY }} - # if: github.event_name != 'pull_request' - # uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c - # with: - # registry: ${{ env.REGISTRY }} - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Convert $IMAGE_TAG to lowercase + id: tag-to-lowercase + run: | + echo Converting ${{ env.IMAGE_TAG }} to lowercase... + IMAGE_TAG_LOWERCASE=$(echo "${{ env.IMAGE_TAG }}" | tr '[:upper:]' '[:lower:]') + echo "IMAGE_TAG in lowercase is $IMAGE_TAG_LOWERCASE" + echo "IMAGE_TAG_LOWERCASE=$IMAGE_TAG_LOWERCASE" >> $GITHUB_ENV # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action @@ -51,7 +59,7 @@ jobs: context: ${{ env.DOCKERFILE_LOCATION }} file: ${{ env.DOCKERFILE_LOCATION }}/Dockerfile # push: ${{ github.event_name != 'pull_request' }} - tags: ${{ env.IMAGE_TAG }} + tags: ${{ steps.tag-to-lowercase.outputs.IMAGE_TAG_LOWERCASE }} # Sign the resulting Docker image digest except on PRs. # This will only write to the public Rekor transparency log when the Docker @@ -64,4 +72,4 @@ jobs: COSIGN_EXPERIMENTAL: "true" # This step uses the identity token to provision an ephemeral certificate # against the sigstore community Fulcio instance. - run: echo "${{ env.IMAGE_TAG }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }} \ No newline at end of file + run: echo "${{ steps.tag-to-lowercase.outputs.IMAGE_TAG_LOWERCASE }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }} \ No newline at end of file