Publish to npm using a GitHub action (#9588)

This commit is contained in:
Nicolò Ribaudo
2019-03-19 18:59:35 +01:00
committed by GitHub
parent 60005b35e4
commit f2ee84b6a3
5 changed files with 59 additions and 14 deletions

View File

@@ -5,16 +5,8 @@ set -e
echo "INFO: Installing action dependencies..."
(cd /action; npm ci)
# 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 $GITHUB_SHA)
current_tag=$(git log --oneline --format=%B -1 $GITHUB_SHA)
echo "INFO: Creating new tag..."
(git tag $current_tag $GITHUB_SHA) || echo "INFO: Tag already exists"
current_tag=$(git describe --abbrev=0 --tags $GITHUB_SHA)
last_tag=$(git describe --abbrev=0 --tags $current_tag^)
echo "INFO: New version is $current_tag; last version is $last_tag."