-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Github actions workflow for NPM publishes
- Loading branch information
1 parent
5395e36
commit 3c88dc5
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 to NPM | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
always-auth: true | ||
node-version: 16 | ||
cache: 'yarn' | ||
registry-url: 'https://registry.npmjs.org/' | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Get the release tag version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
- name: Set package version | ||
run: yarn version --new-version "${{ steps.get_version.outputs.VERSION }}" --no-git-tag-version | ||
- name: Publish package | ||
run: yarn publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Push version bump | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: 'chore: Bump version to ${{ steps.get_version.outputs.VERSION }}' | ||
file_pattern: 'package.json' | ||
branch: HEAD:master |