Skip to content

[release-new] fix: release pr commit contains (#number) at last #79611

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
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
10 changes: 6 additions & 4 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ env:
#
# See https://doc.rust-lang.org/rustc/platform-support/apple-darwin.html#os-version for more details
MACOSX_DEPLOYMENT_TARGET: 11.0
# This will become "true" if the latest commit is
# "Version Packages" or "Version Pacakges \((canary|rc)\)"
# This will become "true" if the latest commit (merged release PR) is either:
# - "Version Packages (#<number>)"
# - "Version Pacakges (canary/rc) (#<number>)"
# set from scripts/check-is-release.js
__NEW_RELEASE: 'false'

Expand Down Expand Up @@ -50,10 +51,11 @@ jobs:
run: |
# TODO: Remove the new release check once the new release workflow is fully replaced.
RELEASE_CHECK=$(node ./scripts/check-is-release.js 2> /dev/null || :)
if [[ $RELEASE_CHECK =~ ^Version\ Packages(\ \((canary|rc)\))?$ ]];
if [[ $RELEASE_CHECK == 'new-release' ]];
then
echo "__NEW_RELEASE=true" >> $GITHUB_ENV
elif [[ $RELEASE_CHECK = v* ]];
echo "value=production" >> $GITHUB_OUTPUT
elif [[ $RELEASE_CHECK == v* ]];
then
echo "value=production" >> $GITHUB_OUTPUT
elif [ '${{ github.ref }}' == 'refs/heads/canary' ]
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ jobs:
- name: check for release
id: is-release
run: |
if [[ $(node ./scripts/check-is-release.js 2> /dev/null || :) = v* ]];
RELEASE_CHECK=$(node ./scripts/check-is-release.js 2> /dev/null || :)
if [[ $RELEASE_CHECK == "new-release" || $RELEASE_CHECK == v* ]];
then
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
else
Expand Down
9 changes: 6 additions & 3 deletions scripts/check-is-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ const checkIsRelease = async () => {

const versionString = commitMsg.split(' ').pop().trim()
const publishMsgRegex = /^v\d{1,}\.\d{1,}\.\d{1,}(-\w{1,}\.\d{1,})?$/
const newPublishMsgRegex = /^Version Packages( \((canary|rc)\))?$/
const newPublishMsgRegex = /^Version Packages( \((canary|rc)\))?( \(#\d+\))?$/
// When the "Version Packages" PR is merged, it may contain "\n"
// in the message when co-authored, so split and get the first one.
const newPublishPrMessage = commitMsg.split('\n')[0]

if (publishMsgRegex.test(versionString)) {
console.log(versionString)
process.exit(0)
} else if (newPublishMsgRegex.test(commitMsg)) {
console.log(commitMsg)
} else if (newPublishMsgRegex.test(newPublishPrMessage)) {
console.log('new-release')
process.exit(0)
} else {
console.log('not publish commit', { commitId, commitMsg, versionString })
Expand Down
3 changes: 2 additions & 1 deletion scripts/release-stats.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

if [[ $(node ./scripts/check-is-release.js 2> /dev/null || :) = v* ]];
RELEASE_CHECK=$(node ./scripts/check-is-release.js 2> /dev/null || :)
if [[ $RELEASE_CHECK == "new-release" || $RELEASE_CHECK == v* ]];
then
echo "Publish occurred, running release stats..."
else
Expand Down
Loading