Skip to content

Commit

Permalink
Image tag to lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
dragosMC91 committed Feb 19, 2024
1 parent 86191df commit 3f4cf72
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}
run: echo "${{ steps.tag-to-lowercase.outputs.IMAGE_TAG_LOWERCASE }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}

0 comments on commit 3f4cf72

Please sign in to comment.