Skip to content

Commit 5283c4c

Browse files
committed
chore(cli): set npm dist tag (#350)
1 parent a515f08 commit 5283c4c

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Publish package
3030
run: |
3131
rm -rf .npmrc && echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN_KOOBIQ" > ~/.npmrc
32-
npm run release:publish:ci-github
32+
npm run release:publish:ci-github -- -t v17-lts
3333
env:
3434
NPM_TOKEN_KOOBIQ: ${{ secrets.NPM_PUBLISH_TOKEN }}
3535
MATTERMOST_ENDPOINT_URL: ${{ secrets.MM_WEBHOOK_URL }}

packages/cli/src/cli.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const runCliCommands = () => {
2727
.option('-p, --project-dir <string>', 'project root directory', process.env['RELEASE_PROJECT'] ?? ROOT_DIR)
2828
.option('-d, --dist-dir <string>', 'packages dist directory', process.env['RELEASE_DIST'] ?? DIST_DIR)
2929
.option('-c, --changelog-scope <string>', 'default changelog scope', process.env['CHANGELOG_SCOPE'] ?? 'koobiq')
30+
.option('-t, --tag-name <string>', 'Name of the NPM dist tag.', 'latest')
3031
.option('-n, --without-references', 'exclude changelog links', false)
3132
.option('-n, --without-notification', 'cancel mattermost notifications', false)
3233
.option('-o, --repo-owner <string>', 'github owner name', process.env['REPO_OWNER'] ?? 'koobiq')

packages/cli/src/release/base-release-task.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface IReleaseTaskConfig {
1515
projectDir: string;
1616
repoToken: string;
1717
distDir: string;
18+
tagName: string;
1819
repoOwner: string;
1920
repoName: string;
2021
repoUrl: string;

packages/cli/src/release/publish-release-github-ci.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class PublishReleaseCIGithubTask extends BaseReleaseTask {
5353

5454
this.checkReleaseOutput();
5555

56-
const npmDistTag = 'latest';
56+
const npmDistTag = this.config.tagName;
5757

5858
for (const packageName of this.packageJson.release.packages) {
5959
this.publishPackageToNpm(packageName, npmDistTag);
@@ -84,7 +84,7 @@ export class PublishReleaseCIGithubTask extends BaseReleaseTask {
8484

8585
/** Publishes the specified package within the given NPM dist tag. */
8686
private publishPackageToNpm(packageName: string, npmDistTag: string) {
87-
console.info(green(` ⭮ Publishing "${packageName}"..`));
87+
console.info(green(` ⭮ Publishing "${packageName}" with tag ${npmDistTag}..`));
8888

8989
const errorOutput = npmPublish(join(this.releaseOutputPath, packageName), npmDistTag);
9090

packages/cli/src/release/publish-release-gitlab-ci.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class PublishReleaseCIGitlabTask extends BaseReleaseTask {
5353

5454
this.checkReleaseOutput();
5555

56-
const npmDistTag = 'latest';
56+
const npmDistTag = this.config.tagName;
5757

5858
for (const packageName of this.packageJson.release.packages) {
5959
this.publishPackageToNpm(packageName, npmDistTag);
@@ -84,7 +84,7 @@ export class PublishReleaseCIGitlabTask extends BaseReleaseTask {
8484

8585
/** Publishes the specified package within the given NPM dist tag. */
8686
private publishPackageToNpm(packageName: string, npmDistTag: string) {
87-
console.info(green(` ⭮ Publishing "${packageName}"..`));
87+
console.info(green(` ⭮ Publishing "${packageName}" with tag ${npmDistTag}..`));
8888

8989
const errorOutput = npmPublish(join(this.releaseOutputPath, packageName), npmDistTag);
9090

0 commit comments

Comments
 (0)