-
-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (31 loc) · 948 Bytes
/
npm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Publish to npm
on:
push:
branches:
- main
jobs:
npm:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
# Defaults to the user or organization that owns the workflow file
scope: ''
- run: npm install
- name: Get current package version
run: echo "NPM_VERSION=$(npm ls --json|jq -r .version)" >> $GITHUB_ENV
- name: Tag branch with current package version
uses: negz/create-tag@v1
with:
version: "v${{ env.NPM_VERSION }}"
message: "v${{ env.NPM_VERSION }}"
token: ${{ secrets.GITHUB_TOKEN }}
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}