Skip to content

Commit eb453c6

Browse files
committed
ci: add github actions for automatic test/deploy to npm package on every new release
ci: removed useless build step , move yarn install before tests ci: use caching for dependencies ci(package.json): convert husky install condintional , depending current environment ci: remove cache from publish job
1 parent c30ae86 commit eb453c6

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

.github/workflows/publish_npm.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish to NPM
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 16.x
15+
cache: 'yarn'
16+
- run: yarn --frozen-lockfile
17+
- run: yarn run test
18+
19+
publish:
20+
needs: test
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
- name: Setup Node
26+
uses: actions/setup-node@v2
27+
with:
28+
node-version: '16.x'
29+
registry-url: 'https://registry.npmjs.org'
30+
scope: '@t13'
31+
- run: yarn --frozen-lockfile
32+
- name: Publish package on NPM 📦
33+
run: npm publish
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "queue-xec-master",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "Master queue, push jobs and gathers results from online workers.",
55
"main": "index.js",
66
"scripts": {
77
"test": "jest --forceExit",
88
"test:dev": "jest --watch ",
99
"lint": "eslint --ext .js,.ts .",
1010
"format": "prettier --write .",
11-
"prepare": "husky install"
11+
"prepare": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install"
1212
},
1313
"author": "KosM",
1414
"license": "MIT",

0 commit comments

Comments
 (0)