Skip to content

Commit 36b30d3

Browse files
authored
fix: Auto release on action (#33)
1 parent d57cd90 commit 36b30d3

File tree

5 files changed

+58
-64
lines changed

5 files changed

+58
-64
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "eslint-config-egg"
3+
}

.github/workflows/nodejs.yml

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,21 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
4-
name: Node.js CI
1+
name: CI
52

63
on:
74
push:
8-
branches:
9-
- main
10-
- master
5+
branches: [ master ]
6+
117
pull_request:
12-
branches:
13-
- main
14-
- master
8+
branches: [ master ]
9+
1510
schedule:
1611
- cron: '0 2 * * *'
1712

18-
jobs:
19-
build:
20-
runs-on: ${{ matrix.os }}
21-
22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
node-version: [14, 16, 18]
26-
os: [ubuntu-latest, macos-latest]
13+
workflow_dispatch: {}
2714

28-
steps:
29-
- name: Checkout Git Source
30-
uses: actions/checkout@v2
31-
32-
- name: Use Node.js ${{ matrix.node-version }}
33-
uses: actions/setup-node@v1
34-
with:
35-
node-version: ${{ matrix.node-version }}
36-
37-
- name: Install Dependencies
38-
run: npm i
39-
40-
- name: Continuous Integration
41-
run: npm run ci
42-
43-
- name: Code Coverage
44-
uses: codecov/codecov-action@v1
45-
with:
46-
token: ${{ secrets.CODECOV_TOKEN }}
15+
jobs:
16+
Job:
17+
name: Node.js
18+
uses: artusjs/github-actions/.github/workflows/node-test.yml@v1
19+
with:
20+
os: 'ubuntu-latest, macos-latest'
21+
version: '14, 16, 18'

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release
2+
3+
on:
4+
# 合并后自动发布
5+
push:
6+
branches: [ master ]
7+
8+
# 手动发布
9+
workflow_dispatch: {}
10+
11+
jobs:
12+
release:
13+
name: Node.js
14+
uses: artusjs/github-actions/.github/workflows/node-release.yml@v1
15+
secrets:
16+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
17+
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
18+
with:
19+
checkTest: false

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@
88
"lib"
99
],
1010
"scripts": {
11+
"lint": "eslint test",
1112
"test": "egg-bin test",
1213
"ci": "egg-bin cov",
1314
"contributors": "git-contributor"
1415
},
1516
"dependencies": {},
1617
"devDependencies": {
17-
"@types/node": "^12.7.2",
18-
"egg-bin": "^4.19.0",
19-
"egg-ci": "^2.1.0",
18+
"@types/node": "14",
19+
"egg-bin": "^5.6.1",
20+
"eslint": "^8.30.0",
21+
"eslint-config-egg": "^12.1.0",
2022
"git-contributor": "^1.1.0",
2123
"mm": "*",
2224
"runscript": "^1.4.0",
23-
"typescript": "^3.5.3"
25+
"typescript": "4"
2426
},
2527
"repository": {
2628
"type": "git",
@@ -35,11 +37,6 @@
3537
"engines": {
3638
"node": ">= 10.0.0"
3739
},
38-
"ci": {
39-
"version": "14, 16, 18",
40-
"type": "github",
41-
"os": "linux, macos"
42-
},
4340
"author": "fengmk2 <fengmk2@gmail.com>",
4441
"license": "MIT"
4542
}

test/address.test.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('test/address.test.js', () => {
7272
mm.data(child, 'exec', fs.readFileSync(path.join(fixtures, 'darwin.txt'), 'utf8'));
7373
address('vnic', (err, addr) => {
7474
assert(!err);
75-
assert.strictEqual(addr.ip, '10.211.55.2')
75+
assert.strictEqual(addr.ip, '10.211.55.2');
7676
assert(!addr.ipv6);
7777
done();
7878
});
@@ -180,13 +180,13 @@ describe('test/address.test.js', () => {
180180
mm(os, 'networkInterfaces', () => {
181181
return {
182182
lo:
183-
[ { address: '127.0.0.1',
184-
family: 'IPv4',
185-
internal: true } ],
183+
[{ address: '127.0.0.1',
184+
family: 'IPv4',
185+
internal: true }],
186186
bond0:
187-
[ { address: '10.206.52.79',
188-
family: 'IPv4',
189-
internal: false } ] };
187+
[{ address: '10.206.52.79',
188+
family: 'IPv4',
189+
internal: false }] };
190190
});
191191
assert.strictEqual(address.ip(), '10.206.52.79');
192192
});
@@ -195,17 +195,17 @@ describe('test/address.test.js', () => {
195195
mm(os, 'networkInterfaces', () => {
196196
return {
197197
lo:
198-
[ { address: '127.0.0.1',
199-
family: 'IPv4',
200-
internal: true } ],
201-
utun0:
202-
[ { address: 'fe80::696:ad3d:eeec:1722',
203-
family: 'IPv6',
204-
internal: false } ],
198+
[{ address: '127.0.0.1',
199+
family: 'IPv4',
200+
internal: true }],
201+
utun0:
202+
[{ address: 'fe80::696:ad3d:eeec:1722',
203+
family: 'IPv6',
204+
internal: false }],
205205
utun1:
206-
[ { address: '10.206.52.79',
207-
family: 'IPv4',
208-
internal: false } ] };
206+
[{ address: '10.206.52.79',
207+
family: 'IPv4',
208+
internal: false }] };
209209
});
210210
assert.strictEqual(address.ip('utun'), '10.206.52.79');
211211
assert.strictEqual(address.ipv6('utun'), 'fe80::696:ad3d:eeec:1722');

0 commit comments

Comments
 (0)