From 1326e72285ca0096ae7ab3cb8604b1c2816a8b67 Mon Sep 17 00:00:00 2001 From: vdaas-ci <57942646+vdaas-ci@users.noreply.github.com> Date: Fri, 16 Feb 2024 17:38:17 +0900 Subject: [PATCH] add commit hash build image (#2359) (#2371) Signed-off-by: kpango Co-authored-by: Yusuke Kato --- .github/actions/docker-build/action.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/docker-build/action.yaml b/.github/actions/docker-build/action.yaml index d1cca998b6..f1a0e462fa 100644 --- a/.github/actions/docker-build/action.yaml +++ b/.github/actions/docker-build/action.yaml @@ -91,6 +91,11 @@ runs: latest_tags="-t ${IMAGE_NAME}:latest -t ${ALTER_IMAGE_NAME}:latest" extra_tags="${extra_tags} ${latest_tags}" fi + if [[ "$GITHUB_REF" =~ ^refs/heads/main$ ]] || [[ "$GITHUB_REF" =~ ^refs/heads/master$ ]] || [[ "$GITHUB_REF" =~ ^refs/heads/release.* ]] || [[ "${PRIMARY_TAG}" == "nightly" ]]; then + commit_hash=${GITHUB_SHA::8} + hash_tags="-t ${IMAGE_NAME}:${commit_hash} -t ${ALTER_IMAGE_NAME}:${commit_hash}" + extra_tags="${extra_tags} ${hash_tags}" + fi echo "EXTRA_TAGS is determined: ${extra_tags}" echo "EXTRA_TAGS=${extra_tags}" >> $GITHUB_OUTPUT env: