Skip to content

Commit

Permalink
Update build_and_push.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
danamzulescu-codefresh committed Apr 9, 2023
1 parent 3074d20 commit d2502e6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,24 @@ jobs:
- name: Derive Docker image tag
run: |
if [[ "${github.ref}" == "refs/tags/"* ]]; then
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
# If git ref is a tag, set docker_image_tag to the tag name
docker_image_tag="${github.ref/refs\/tags\//}}"
docker_image_tag="${{ github.ref/refs\/tags\//}}"
else
# If git ref is not a tag, set docker_image_tag to the commit hash
docker_image_tag="${github.sha}"
docker_image_tag="${{ github.sha }}"
fi
echo "1"
echo "$docker_image_tag"
echo "2"
# Replace slashes with hyphens
docker_image_tag="${docker_image_tag/\//-}"
# Replace slashes with hyphens using tr command
docker_image_tag="${{ docker_image_tag//\//- }}"
# Replace other special characters with hyphens
docker_image_tag="${docker_image_tag//[^a-zA-Z0-9.-]/-}"
docker_image_tag="${{ docker_image_tag//[^a-zA-Z0-9.-]/- }}"
# Convert to lowercase
docker_image_tag="${docker_image_tag,,}"
docker_image_tag="${{ docker_image_tag,, }}"
echo "Docker image tag: $docker_image_tag"
echo "docker_image_tag=$docker_image_tag" >> $GITHUB_ENV
Expand Down

0 comments on commit d2502e6

Please sign in to comment.