Skip to content

Commit

Permalink
chore(repo): allow e2e workflows to publish relative versions (nrwl#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry authored Jun 20, 2024
1 parent 7699b33 commit 472459d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/nx-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit 472459d

Please sign in to comment.