File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff 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) 2> /dev/null)
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,8 +49,10 @@ 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
41- echo " Commit message: ${COMMIT_MESSAGE} "
55+ echo " Commit message was: ' ${COMMIT_MESSAGE} ' "
4256
4357 if [[ ${COMMIT_MESSAGE} =~ " [publish binary]" ]]; then
4458 echo " Publishing"
@@ -75,4 +89,4 @@ case $i in
7589esac
7690done
7791
78- publish $@
92+ publish $@
You can’t perform that action at this time.
0 commit comments