Create a new release after a v*.*.* commit instead of the tag (#9470)

* Create a new release after a v*.*.* commit instead of the tag

* Fix bugs

* Avoid matching things like "v2"
This commit is contained in:
Nicolò Ribaudo
2019-02-15 21:42:51 +01:00
committed by GitHub
parent 83cbc11d46
commit b25fea49fe
4 changed files with 50 additions and 8 deletions

View File

@@ -5,11 +5,20 @@ set -e
echo "INFO: Installing action dependencies..."
(cd /action; npm ci)
echo "INFO: Checking out current tag..."
git -c advice.detachedHead=false checkout $GITHUB_REF
echo "INFO: Checking out current commit..."
git -c advice.detachedHead=false checkout $GITHUB_SHA
# GitHub doesn't support running actions on new tags yet: we need to run it on the commit.
# For this reason, we can't be sure that the tag already exists. We can use the commit
# message to create the tag. If the tag already exists locally, they won't conflict because
# they have the same name and are on the same commit.
echo "INFO: Getting release version..."
# current_tag=$(git describe --abbrev=0 --tags HEAD)
current_tag=$(git log --oneline --format=%B -1 HEAD)
echo "INFO: Creating new tag..."
(git tag $current_tag $GITHUB_SHA) || echo "INFO: Tag already exists"
echo "INFO: Getting tag info..."
current_tag=$(git describe --abbrev=0 --tags)
last_tag=$(git describe --abbrev=0 --tags HEAD^)
echo "INFO: New version is $current_tag; last version is $last_tag."