mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-10 01:16:39 +02:00
fix: update npm publish script to select correct dist-tag
This commit is contained in:
parent
60c1265ac4
commit
636f03257f
3
.github/workflows/release.yaml
vendored
3
.github/workflows/release.yaml
vendored
@ -23,7 +23,8 @@ jobs:
|
||||
- run: |
|
||||
yarn install --frozen-lockfile
|
||||
- run: |
|
||||
TAG=$(echo $GITHUB_REF_NAME | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?')
|
||||
LATEST=$(npm show unleash-server version)
|
||||
TAG=${node scripts/npm-tag.js $LATEST}
|
||||
npm publish --tag ${TAG:-latest}
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
18
scripts/npm-tag.js
Normal file
18
scripts/npm-tag.js
Normal file
@ -0,0 +1,18 @@
|
||||
const semver = require('semver');
|
||||
|
||||
const latestUnleashVersion = process.argv[2];
|
||||
|
||||
const version = require('../package.json').version;
|
||||
|
||||
function isPrerelease(version) {
|
||||
const arr = semver.prerelease(version);
|
||||
return arr && arr.length > 0;
|
||||
}
|
||||
|
||||
if(isPrerelease(version)){
|
||||
console.log('beta')
|
||||
}else if(semver.gt(version, latestUnleashVersion)) {
|
||||
console.log('latest');
|
||||
} else {
|
||||
console.log('previous');
|
||||
}
|
Loading…
Reference in New Issue
Block a user