From 472459d9f5c4748a8eafd7895df884d77c26d100 Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 21 Jun 2024 00:11:35 +0400 Subject: [PATCH] chore(repo): allow e2e workflows to publish relative versions (#26609) --- scripts/nx-release.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/nx-release.ts b/scripts/nx-release.ts index 2556d7f7c6c87..0f4a0027ce4bb 100755 --- a/scripts/nx-release.ts +++ b/scripts/nx-release.ts @@ -199,6 +199,9 @@ const VALID_AUTHORS_FOR_LATEST = [ })(); function parseArgs() { + const registry = getRegistry(); + const registryIsLocalhost = registry.hostname === 'localhost'; + const parsedArgs = yargs .scriptName('pnpm nx-release') .wrap(144) @@ -241,10 +244,14 @@ function parseArgs() { default: 'minor', coerce: (version: string) => { const isGithubActions = !!process.env.GITHUB_ACTIONS; - if (isGithubActions && isRelativeVersionKeyword(version)) { + if ( + isGithubActions && + !registryIsLocalhost && + isRelativeVersionKeyword(version) + ) { // Print error rather than throw to avoid yargs noise in this specifically handled case console.error( - 'Error: The release script was triggered in a GitHub Actions workflow, but a relative version keyword was provided. This is an unexpected combination.' + 'Error: The release script was triggered in a GitHub Actions workflow, to a non-local registry, but a relative version keyword was provided. This is an unexpected combination.' ); process.exit(1); } @@ -335,8 +342,6 @@ function parseArgs() { ) .demandOption('version') .check((args) => { - const registry = getRegistry(); - const registryIsLocalhost = registry.hostname === 'localhost'; if (!args.local) { if (!process.env.GH_TOKEN) { throw new Error('process.env.GH_TOKEN is not set');