Skip to content
Snippets Groups Projects
Commit ffa30139 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Improved npm dist-tag detection in case when given commits belongs also to...

Improved npm dist-tag detection in case when given commits belongs also to master & develop branches.
parent d4e29410
No related branches found
No related tags found
1 merge request!56Improved npm dist-tag detection and support for git tags specific only to subproject in given repository
...@@ -20,12 +20,20 @@ pushd "${PROJECT_DIR}" ...@@ -20,12 +20,20 @@ pushd "${PROJECT_DIR}"
GIT_COMMIT_HASH=$(git rev-parse HEAD) GIT_COMMIT_HASH=$(git rev-parse HEAD)
SHORT_HASH=$(git rev-parse --short HEAD) SHORT_HASH=$(git rev-parse --short HEAD)
CURRENT_BRANCH_IMPL=$(git branch -r --contains "${SHORT_HASH}")
# warning: same commit can be referenced from multiple branches. It often happens between main/master and develop branches. Let's make a priority for main/master
CURRENT_BRANCH_IMPL=$(git branch -r --contains "${SHORT_HASH}" --list origin/master --list origin/main)
if [ "${CURRENT_BRANCH_IMPL}" = "" ]; then
CURRENT_BRANCH_IMPL=$(git branch -r --contains "${SHORT_HASH}" --list origin/develop)
fi
if [ "${CURRENT_BRANCH_IMPL}" = "" ]; then if [ "${CURRENT_BRANCH_IMPL}" = "" ]; then
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
else else
CURRENT_BRANCH="${CURRENT_BRANCH_IMPL#*/}" CURRENT_BRANCH="${CURRENT_BRANCH_IMPL#*/}"
fi fi
GIT_COMMIT_TIME=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd") GIT_COMMIT_TIME=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd")
TAG_TIME=${GIT_COMMIT_TIME:2} TAG_TIME=${GIT_COMMIT_TIME:2}
TAG=$(git tag --sort=-taggerdate | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+(-.+)?' | head -1) TAG=$(git tag --sort=-taggerdate | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+(-.+)?' | head -1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment