Skip to content
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

chore(repo): allow workflows to publish to localhost in github actions #26609

Merged
merged 1 commit into from
Jun 20, 2024
Merged
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
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