From e0ddfc8a15c1a9c58c6690fa04c1c11e207db3d5 Mon Sep 17 00:00:00 2001 From: Riccardo Date: Tue, 22 Nov 2022 15:02:21 +0000 Subject: [PATCH] [LOCAL] bypass tag check in dry run (#35428) --- scripts/bump-oss-version.js | 2 +- scripts/prepare-package-for-release.js | 14 +++++++------- scripts/release-utils.js | 8 +++++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/bump-oss-version.js b/scripts/bump-oss-version.js index 21bf2d71043ade..bf8c3d8e91394a 100755 --- a/scripts/bump-oss-version.js +++ b/scripts/bump-oss-version.js @@ -76,7 +76,7 @@ async function main() { ); const token = argv.token; const releaseVersion = argv.toVersion; - failIfTagExists(releaseVersion); + failIfTagExists(releaseVersion, 'release'); const {pushed} = await inquirer.prompt({ type: 'confirm', diff --git a/scripts/prepare-package-for-release.js b/scripts/prepare-package-for-release.js index 05d72be149f5dd..2a61023caef8b0 100755 --- a/scripts/prepare-package-for-release.js +++ b/scripts/prepare-package-for-release.js @@ -50,7 +50,13 @@ const releaseVersion = argv.toVersion; const isLatest = argv.latest; const isDryRun = argv.dryRun; -failIfTagExists(releaseVersion); +const buildType = isDryRun + ? 'dry-run' + : isReleaseBranch(branch) + ? 'release' + : 'nightly'; + +failIfTagExists(releaseVersion, buildType); if (branch && !isReleaseBranch(branch) && !isDryRun) { console.error(`This needs to be on a release branch. On branch: ${branch}`); @@ -60,12 +66,6 @@ if (branch && !isReleaseBranch(branch) && !isDryRun) { exit(1); } -const buildType = isDryRun - ? 'dry-run' - : isReleaseBranch(branch) - ? 'release' - : 'nightly'; - const {version} = parseVersion(releaseVersion, buildType); if (version == null) { console.error(`Invalid version provided: ${releaseVersion}`); diff --git a/scripts/release-utils.js b/scripts/release-utils.js index 077096aa48fdec..8675bd41545f93 100644 --- a/scripts/release-utils.js +++ b/scripts/release-utils.js @@ -117,7 +117,13 @@ function generateiOSArtifacts( return tarballOutputPath; } -function failIfTagExists(version) { +function failIfTagExists(version, buildType) { + // When dry-run in stable branch, the tag already exists. + // We are bypassing the tag-existence check when in a dry-run to have the CI pass + if (buildType === 'dry-run') { + return; + } + if (checkIfTagExists(version)) { echo(`Tag v${version} already exists.`); echo('You may want to rollback the last commit');