Skip to content

Commit 72a3c2b

Browse files
committed
Fix pre-release publishing
Allows 'prerelease' as a version argument to increment RC versions. Ensures that the version bump commit and tag are pushed to GitHub even for pre-releases, preventing subsequent runs from attempting to publish the same version.
1 parent 92bc127 commit 72a3c2b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

scripts/publish.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ VERSION=$1
1414
if [[ $VERSION == "" ]]; then
1515
printusage
1616
exit 1
17-
elif [[ ! ($VERSION == "patch" || $VERSION == "minor" || $VERSION == "major") ]]; then
17+
elif [[ ! ($VERSION == "patch" || $VERSION == "minor" || $VERSION == "major" || $VERSION == "prerelease") ]]; then
1818
printusage
1919
exit 1
2020
fi
@@ -89,7 +89,11 @@ echo "Ran publish build."
8989

9090
echo "Making a $VERSION version..."
9191
if [[ $PRE_RELEASE != "" ]]; then
92-
npm version pre$VERSION --preid=rc
92+
if [[ $VERSION == "prerelease" ]]; then
93+
npm version prerelease --preid=rc
94+
else
95+
npm version pre$VERSION --preid=rc
96+
fi
9397
else
9498
npm version $VERSION
9599
fi
@@ -118,6 +122,10 @@ fi
118122
npm publish "${PUBLISH_ARGS[@]}"
119123
echo "Published to npm."
120124

125+
echo "Pushing to GitHub..."
126+
git push origin master --tags
127+
echo "Pushed to GitHub."
128+
121129
if [[ $PRE_RELEASE != "" ]]; then
122130
echo "Published a pre-release version. Skipping post-release actions."
123131
exit

0 commit comments

Comments
 (0)