Skip to content

Commit acb4ecf

Browse files
author
Dane Springmeyer
committed
attempt to skip publish if commit represents a tag
1 parent 5383586 commit acb4ecf

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

scripts/publish.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ function is_pr_merge() {
2525
fi
2626
}
2727

28+
# Detect if this commit represents a tag. This is useful
29+
# to detect if we are on a travis job that is running due to
30+
# "git tags --push". In this case we don't want to publish even
31+
# if [publish binary] is present since that should refer only to the
32+
# previously job that ran for that commit and not the tag made
33+
function is_tag_commit() {
34+
export COMMIT_MATCHES_KNOWN_TAG=$(git describe --exact-match $(git rev-parse HEAD))
35+
if [[ ${COMMIT_MATCHES_KNOWN_TAG} ]]; then
36+
echo true
37+
fi
38+
}
39+
2840
# `publish` is used to publish binaries to s3 via commit messages if:
2941
# - the commit message includes [publish binary]
3042
# - the commit message includes [republish binary]
@@ -37,6 +49,8 @@ function publish() {
3749

3850
if [[ $(is_pr_merge) ]]; then
3951
echo "Skipping publishing because this is a PR merge commit"
52+
elif [[ $(is_tag_commit) ]]; then
53+
echo "Skipping publishing because this is a tag"
4054
else
4155
echo "Commit message: ${COMMIT_MESSAGE}"
4256

@@ -75,4 +89,4 @@ case $i in
7589
esac
7690
done
7791

78-
publish $@
92+
publish $@

0 commit comments

Comments
 (0)