-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52ff880
commit cd7a34b
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: 'Publish to npm' | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [14.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Publish to npm | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
registry-url: 'https://registry.npmjs.org' | ||
cache: 'yarn' | ||
- run: | | ||
yarn install --frozen-lockfile | ||
- run: | | ||
LATEST=$(npm show @unleash/proxy-client-js version) | ||
TAG=$(node scripts/npm-tag.js $LATEST) | ||
npm publish --tag ${TAG:-latest} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 'Releases' | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
release: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Build changelog | ||
id: github_release | ||
uses: metcalfc/changelog-generator@v0.4.4 | ||
with: | ||
myToken: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body: ${{ steps.github_release.outputs.changelog }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
} |