-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add publish workflow (only runs on main)
- Loading branch information
Showing
1 changed file
with
34 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,34 @@ | ||
name: Publish NPM package @dev version | ||
|
||
# This workflow runs whenever a commit is pushed on main | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish-npm-package: | ||
name: Publish NPM package | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node & NPM | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
# New version will be <npm version>.<commit hash>, e.g. 1.1.1-dev.0a4c598 | ||
- name: Adjust package version according to branch & commit | ||
run: npm version $(node --print 'require("./package.json").version').$(git rev-parse --short HEAD) --no-git-tag-version --allow-same-version | ||
|
||
- name: Publish NPM package with @dev tag | ||
run: npm publish --tag dev | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |