Skip to content

Commit d67dbd6

Browse files
committed
Fixed github token env variable name
Added escape skip flag to avoid republishing the same version Added missing git commit . after version increase
1 parent 7be5e9f commit d67dbd6

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

travis/release.sh

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if [ "$TRAVIS_BRANCH" = "$RELEASE_BRANCH" ]; then
99
git remote rm $REMOTE_NAME
1010

1111
echo "Setting remote url https://github.com/${TRAVIS_REPO_SLUG}.git"
12-
git remote add $REMOTE_NAME "https://${GRGIT_USER}@github.com/${TRAVIS_REPO_SLUG}.git" > /dev/null 2>&1
12+
git remote add $REMOTE_NAME "https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" >/dev/null 2>&1
1313

1414
echo "Checking out $RELEASE_BRANCH as travis leaves the head detached."
1515
git checkout $RELEASE_BRANCH
@@ -25,24 +25,32 @@ if [ "$TRAVIS_BRANCH" = "$RELEASE_BRANCH" ]; then
2525
echo ""
2626

2727
echo "Creating tag v$CURRENT_VERSION"
28-
git tag "v$CURRENT_VERSION"
29-
echo ""
28+
git tag -fa "v$CURRENT_VERSION" -m "Releasing version $CURRENT_VERSION"
3029

3130
cp travis/.npmrc $HOME/.npmrc
3231

33-
echo "Releasing sdk artifacts"
34-
npm publish
35-
echo ""
32+
# The $SKIP_RELEASE_PUBLISH env variable can avoid republishing the same version to npm if something in the release process fails.
33+
if [ "$SKIP_RELEASE_PUBLISH" = "true" ]; then
34+
echo "Skipping publishing of sdk artifacts"
35+
echo ""
36+
else
37+
echo "Publishing SDK artifacts"
38+
npm publish
39+
echo ""
40+
fi
3641

3742
echo "Increasing sdk version"
38-
npm version patch -m "Increasing version to %s" --git-tag-version false
43+
npm version patch -m "Increasing version to %s" --git-tag-version false
3944

4045
CURRENT_VERSION=$(npm run version --silent)
4146

4247
echo "New Version"
4348
cat "$CURRENT_VERSION"
4449
echo ""
4550

51+
git add .
52+
git commit -m "Creating new version $CURRENT_VERSION"
53+
4654
echo "Pushing code to $REMOTE_NAME $POST_RELEASE_BRANCH"
4755
git push --set-upstream $REMOTE_NAME $RELEASE_BRANCH:$POST_RELEASE_BRANCH
4856
echo "Pushing tags to $REMOTE_NAME"

0 commit comments

Comments
 (0)