Skip to content

Commit 1d279c0

Browse files
committed
fix: if condition
1 parent 03f8143 commit 1d279c0

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
type: choice
88
description: "Release Npm Tag"
99
required: true
10-
default: "latest"
10+
default: "nightly"
1111
options:
1212
- canary
1313
- nightly
@@ -58,9 +58,9 @@ jobs:
5858
run: pnpm run test
5959

6060
- name: Dry run release to npm
61-
if: inputs.dry_run == 'true'
62-
run: node scripts/release.js --dry-run --tag ${{ github.event.inputs.tag }}
61+
if: inputs.dry_run
62+
run: node scripts/release.mjs --dry-run --tag ${{ inputs.tag }}
6363

64-
- name: Dry run release to npm
65-
if: inputs.dry_run == 'false'
66-
run: node scripts/release.js --tag ${{ github.event.inputs.tag }}
64+
- name: Release to npm
65+
if: ${{ !inputs.dry_run }}
66+
run: node scripts/release.mjs --tag ${{ inputs.tag }}

scripts/release.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,24 @@ const parsed = cli.parse();
2525
const npmTag = parsed.options.tag;
2626
const isDryRun = parsed.options.dryRun;
2727

28-
const allowedTags = ['latest', 'canary', 'alpha', 'beta', 'rc'];
28+
const allowedTags = ['latest', 'canary', 'alpha', 'beta', 'rc', 'nightly'];
2929
if (!allowedTags.includes(npmTag)) {
3030
throw new Error(
3131
`Invalid npm tag: ${npmTag}. Allowed tags: ${allowedTags.join(', ')}`,
3232
);
3333
}
3434

35-
const prereleaseTags = ['alpha', 'beta', 'rc', 'canary'];
35+
const prereleaseTags = ['alpha', 'beta', 'rc', 'canary', 'nightly'];
3636
if (
3737
npmTag === 'latest' &&
3838
prereleaseTags.some((tag) => publishVersion.includes(tag))
3939
) {
4040
throw Error(`Can't release ${publishVersion} to latest tag`);
4141
}
4242

43-
console.info(`Release ${npmTag} version ${publishVersion}`);
43+
console.info(
44+
`Release ${npmTag} version ${publishVersion}${isDryRun ? '(dry-run)' : ''}`,
45+
);
4446

4547
try {
4648
const flags = isDryRun

0 commit comments

Comments
 (0)