Skip to content

Update release script to support making release candidates #1261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions scripts/publish.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ npm run build:release
echo "Ran publish build."

echo "Making a $VERSION version..."
# TODO: Remove the following command.
# npm version command had previously failed claiming unclean git repo, and we don't know why.
echo "DEBUG: Running git status to show dirty files..."
git status
npm version $VERSION
if [[ $PRE_RELEASE != "" ]]; then
npm version pre$VERSION --preid=rc
else
npm version $VERSION
fi
NEW_VERSION=$(jq -r ".version" package.json)
echo "Made a $VERSION version."
echo "Made a $NEW_VERSION version."

echo "Making the release notes..."
RELEASE_NOTES_FILE=$(mktemp)
Expand All @@ -105,14 +105,19 @@ cat CHANGELOG.md >> "${RELEASE_NOTES_FILE}"
echo "Made the release notes."

echo "Publishing to npm..."
if [[ $DRY_RUN == "" ]]; then
npm publish
else
if [[ $DRY_RUN != "" ]]; then
echo "DRY RUN: running publish with --dry-run"
npm publish --dry-run
else
npm publish
fi
echo "Published to npm."

if [[ $PRE_RELEASE != "" ]]; then
echo "Published a pre-release version. Skipping post-release actions."
exit
fi

if [[ $DRY_RUN != "" ]]; then
echo "All other commands are mutations, and we are doing a dry run."
echo "Terminating."
Expand Down
2 changes: 2 additions & 0 deletions scripts/publish/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ steps:
- "REPOSITORY_ORG=${_REPOSITORY_ORG}"
- "REPOSITORY_NAME=${_REPOSITORY_NAME}"
- "DRY_RUN=${_DRY_RUN}"
- "PRE_RELEASE=${_PRE_RELEASE}"

options:
volumes:
Expand All @@ -107,6 +108,7 @@ options:

substitutions:
_VERSION: ""
_PRE_RELEASE: ""
_DRY_RUN: ""
_KEY_RING: "npm-publish-keyring"
_KEY_NAME: "publish"
Expand Down