-
Notifications
You must be signed in to change notification settings - Fork 9
58 lines (48 loc) · 1.5 KB
/
npm-publish.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: npm-publish
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up node.js
uses: actions/setup-node@v1
with:
node-version: 16.15.0
registry-url: https://registry.npmjs.org/
- name: version
id: create_version
run: |
git config user.name $GITHUB_ACTOR
git config user.email gh-actions-${GITHUB_ACTOR}@github.com
npm version patch
git push origin master --force
content=`cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g'`
echo "::set-output name=version::$content"
- name: install dependencies
run: yarn
- name: run tests
run: yarn test
- name: create version
run: yarn build
- name: publish version
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
check-version: true
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.create_version.outputs.version }}
release_name: ${{ steps.create_version.outputs.version }}
body: ${{ steps.create_version.outputs.version }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}