From 1c2add83966593bcd4fbd75b432d212d1eec6cf3 Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Wed, 21 Apr 2021 20:58:10 +0200
Subject: [PATCH] build: fix npm release (#9672)

---
 .github/workflows/release-npm.yml | 3 ++-
 tools/dispatch-release.mjs        | 2 +-
 tools/utils.mjs                   | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml
index a26410c73b..b7286c4738 100644
--- a/.github/workflows/release-npm.yml
+++ b/.github/workflows/release-npm.yml
@@ -51,6 +51,7 @@ jobs:
       - name: Publish ${{ github.event.client_payload.version }}
         run: |
           echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc
-          npm publish --tag ${{ github.event.client_payload.tag }}
+          npm publish --tag ${TAG:-latest}
         env:
           NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
+          TAG: ${{ github.event.client_payload.tag }}
diff --git a/tools/dispatch-release.mjs b/tools/dispatch-release.mjs
index 927d6e52b1..3bdc53a23f 100644
--- a/tools/dispatch-release.mjs
+++ b/tools/dispatch-release.mjs
@@ -3,7 +3,7 @@ import shell from 'shelljs';
 import { options } from './utils.mjs';
 
 const version = options.release;
-const tag = options.tag;
+const tag = options.tag || 'latest';
 const dry = options.dryRun;
 
 shell.echo(`Dispatching version: ${version}`);
diff --git a/tools/utils.mjs b/tools/utils.mjs
index 6840a0236d..34e0d88af7 100644
--- a/tools/utils.mjs
+++ b/tools/utils.mjs
@@ -6,7 +6,7 @@ program
   .version('0.0.1')
   .requiredOption('-r, --release <type>', 'Version to use')
   .option('-s, --sha <type>', 'Git sha to use')
-  .option('-t, --tag <type>', 'Npm dist-tag to publish to', 'latest')
+  .option('-t, --tag <type>', 'Npm dist-tag to publish to')
   .option('-d, --dry-run');
 
 program.parse(process.argv);
-- 
GitLab