-
Notifications
You must be signed in to change notification settings - Fork 12
55 lines (53 loc) · 1.61 KB
/
npmpublish.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
name: Node.js Package
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 14, 16, 18 ]
name: Node ${{ matrix.node }} sample
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm test
publish-npm:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v1
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:
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm update
- run: npm install
- run: npm audit fix
- run: npm test
- run: git config --global user.email "montumodi@gmail.com"
- run: git config --global user.name "Ashish Modi"
- run: git commit -m "Add changes" -a
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- run: npm version minor
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}