-
Notifications
You must be signed in to change notification settings - Fork 1
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
2dc93a0
commit 581ac26
Showing
2 changed files
with
49 additions
and
1 deletion.
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,48 @@ | ||
name: NPM Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
# the Node.js versions to build on | ||
node-version: [18.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3.6.0 | ||
with: | ||
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | ||
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | ||
|
||
- name: Get tag name | ||
id: tag_name | ||
run: | | ||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build the project | ||
run: npm run build | ||
|
||
- name: Run NodeJS Tests | ||
run: npm run test | ||
|
||
- name: NPM publish beta package | ||
if: ${{ contains(steps.tag_name.outputs.SOURCE_TAG, 'beta') }} | ||
uses: JS-DevTools/npm-publish@v1 | ||
with: | ||
token: ${{ secrets.NPM_TOKEN }} | ||
tag: beta | ||
|
||
- name: NPM publish package | ||
if: ${{ !contains(steps.tag_name.outputs.SOURCE_TAG, 'beta') }} | ||
uses: JS-DevTools/npm-publish@v1 | ||
with: | ||
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