From 1e146075f768c084d3b5c33df867941e822c4d6b Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Wed, 25 Oct 2017 10:28:11 -0700 Subject: [PATCH 1/2] Try to tag on merge to master --- .travis.yml | 2 ++ script/tag_on_master | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 script/tag_on_master diff --git a/.travis.yml b/.travis.yml index f76f7c377..f61020643 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ language: ruby before_install: - gem install bundler - bundle install +after_success: +- script/tag_on_master script: bundle exec rake book:build deploy: provider: releases diff --git a/script/tag_on_master b/script/tag_on_master new file mode 100755 index 000000000..9a3d8c847 --- /dev/null +++ b/script/tag_on_master @@ -0,0 +1,18 @@ +#!/bin/bash + +# This is for running on Travis. It automatically tags any merge to Master as a release in the 2.1.x series. +if [[ $TRAVIS_PULL_REQUEST != 'false' || "$TRAVIS_BRANCH" != 'master' ]]; then + # Don't run on pull requests + echo 'This only runs on a merge to master.' + exit 0 +fi + +# Compute the next tag number +LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3) +PATCH=$(($LASTPATCH+1)) +echo $PATCH + +# Create a tag +curl -H "Authorization: token ${api-key}" \ + -X "{\"ref\": \"refs/tags/2.1.$PATCH\", \"sha\": \"$TRAVIS_COMMIT\"}" \ + https://api.github.com/repos/progit/progit2/git/refs \ No newline at end of file From ae7768b7d0316ef10c7a2ed1e9eb293d4a25729a Mon Sep 17 00:00:00 2001 From: Ben Straub Date: Wed, 25 Oct 2017 10:38:41 -0700 Subject: [PATCH 2/2] Newline at end of file --- script/tag_on_master | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/tag_on_master b/script/tag_on_master index 9a3d8c847..ee3382e5d 100755 --- a/script/tag_on_master +++ b/script/tag_on_master @@ -15,4 +15,4 @@ echo $PATCH # Create a tag curl -H "Authorization: token ${api-key}" \ -X "{\"ref\": \"refs/tags/2.1.$PATCH\", \"sha\": \"$TRAVIS_COMMIT\"}" \ - https://api.github.com/repos/progit/progit2/git/refs \ No newline at end of file + https://api.github.com/repos/progit/progit2/git/refs