Skip to content

Commit 3a243b7

Browse files
committed
parse version commit correctly
1 parent 62153de commit 3a243b7

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

.github/workflows/build_and_deploy.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ jobs:
4343
# 'staging' for canary branch since that will eventually be published i.e. become the production build.
4444
id: deploy-target
4545
run: |
46-
if [[ $(node ./scripts/check-is-release.js 2> /dev/null || :) = v* ]];
46+
# TODO: Remove the new release check once the new release workflow is fully replaced.
47+
RELEASE_CHECK=$(node ./scripts/check-is-release.js 2> /dev/null || :)
48+
if [[ $RELEASE_CHECK =~ ^Version\ Packages\ \((canary|release-candidate|stable)\)$ ]];
49+
then
50+
echo "__NEW_RELEASE=true" >> $GITHUB_ENV
51+
elif [[ $RELEASE_CHECK = v* ]];
4752
then
4853
echo "value=production" >> $GITHUB_OUTPUT
4954
elif [ '${{ github.ref }}' == 'refs/heads/canary' ]

scripts/check-is-release.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@ const checkIsRelease = async () => {
1515
const publishMsgRegex = /^v\d{1,}\.\d{1,}\.\d{1,}(-\w{1,}\.\d{1,})?$/
1616
const newPublishMsgRegex = /^Version Packages$/
1717

18-
if (newPublishMsgRegex.test(versionString)) {
19-
process.env.__NEW_RELEASE = 'true'
20-
}
21-
22-
if (
23-
publishMsgRegex.test(versionString) ||
24-
newPublishMsgRegex.test(versionString)
25-
) {
18+
if (publishMsgRegex.test(versionString)) {
2619
console.log(versionString)
2720
process.exit(0)
21+
} else if (newPublishMsgRegex.test(commitMsg)) {
22+
console.log(commitMsg)
23+
process.exit(0)
2824
} else {
2925
console.log('not publish commit', { commitId, commitMsg, versionString })
3026
process.exit(1)

0 commit comments

Comments
 (0)