Skip to content

Commit

Permalink
Calculate short SHA using parameter expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielKotik committed Jul 3, 2024
1 parent d10d682 commit 77a1a87
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/cpu-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ jobs:
# ((contains(github.ref_name, 'develop') || contains(github.ref_name, 'master')) && needs.build-docker-image-cpu.outputs.docker-tag != 'latest')
# || startsWith(github.ref, 'refs/tags/')
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: '1'
# name: Check out repository
# uses: actions/checkout@v4
# with:
# fetch-depth: '1'

- name: "Prepare environment: Restore cache"
if: env.DOCKER_TAG != 'latest'
Expand All @@ -259,8 +259,11 @@ jobs:
run: |
# Execute on change of Docker image
if [[ "$DOCKER_TAG" == 'latest' ]]; then
GIT_SHA=${GITHUB_REF_NAME}-$(git rev-parse --short "$GITHUB_SHA")
echo "GIT_SHA=$GIT_SHA"
# GIT_SHA=${GITHUB_REF_NAME}-$(git rev-parse --short "$GITHUB_SHA")
# echo "GIT_SHA=$GIT_SHA"
echo "SHELL=$SHELL"
echo "GITHUB_SHA=$GITHUB_SHA"
echo "GITHUB_SHORT_SHA=${GITHUB_SHA:0:7}"
docker tag $IMAGE_NAME:$GITHUB_RUN_ID $IMAGE_REPO/$IMAGE_NAME:latest
docker tag $IMAGE_NAME:$GITHUB_RUN_ID $IMAGE_REPO/$IMAGE_NAME:$GIT_SHA
Expand Down

0 comments on commit 77a1a87

Please sign in to comment.