Skip to content

Commit

Permalink
fix: Auto release on action (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored Dec 17, 2022
1 parent d57cd90 commit 36b30d3
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 64 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "eslint-config-egg"
}
51 changes: 13 additions & 38 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,21 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: CI

on:
push:
branches:
- main
- master
branches: [ master ]

pull_request:
branches:
- main
- master
branches: [ master ]

schedule:
- cron: '0 2 * * *'

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node-version: [14, 16, 18]
os: [ubuntu-latest, macos-latest]
workflow_dispatch: {}

steps:
- name: Checkout Git Source
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm i

- name: Continuous Integration
run: npm run ci

- name: Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
jobs:
Job:
name: Node.js
uses: artusjs/github-actions/.github/workflows/node-test.yml@v1
with:
os: 'ubuntu-latest, macos-latest'
version: '14, 16, 18'
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Release

on:
# 合并后自动发布
push:
branches: [ master ]

# 手动发布
workflow_dispatch: {}

jobs:
release:
name: Node.js
uses: artusjs/github-actions/.github/workflows/node-release.yml@v1
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
with:
checkTest: false
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@
"lib"
],
"scripts": {
"lint": "eslint test",
"test": "egg-bin test",
"ci": "egg-bin cov",
"contributors": "git-contributor"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^12.7.2",
"egg-bin": "^4.19.0",
"egg-ci": "^2.1.0",
"@types/node": "14",
"egg-bin": "^5.6.1",
"eslint": "^8.30.0",
"eslint-config-egg": "^12.1.0",
"git-contributor": "^1.1.0",
"mm": "*",
"runscript": "^1.4.0",
"typescript": "^3.5.3"
"typescript": "4"
},
"repository": {
"type": "git",
Expand All @@ -35,11 +37,6 @@
"engines": {
"node": ">= 10.0.0"
},
"ci": {
"version": "14, 16, 18",
"type": "github",
"os": "linux, macos"
},
"author": "fengmk2 <fengmk2@gmail.com>",
"license": "MIT"
}
34 changes: 17 additions & 17 deletions test/address.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('test/address.test.js', () => {
mm.data(child, 'exec', fs.readFileSync(path.join(fixtures, 'darwin.txt'), 'utf8'));
address('vnic', (err, addr) => {
assert(!err);
assert.strictEqual(addr.ip, '10.211.55.2')
assert.strictEqual(addr.ip, '10.211.55.2');
assert(!addr.ipv6);
done();
});
Expand Down Expand Up @@ -180,13 +180,13 @@ describe('test/address.test.js', () => {
mm(os, 'networkInterfaces', () => {
return {
lo:
[ { address: '127.0.0.1',
family: 'IPv4',
internal: true } ],
[{ address: '127.0.0.1',
family: 'IPv4',
internal: true }],
bond0:
[ { address: '10.206.52.79',
family: 'IPv4',
internal: false } ] };
[{ address: '10.206.52.79',
family: 'IPv4',
internal: false }] };
});
assert.strictEqual(address.ip(), '10.206.52.79');
});
Expand All @@ -195,17 +195,17 @@ describe('test/address.test.js', () => {
mm(os, 'networkInterfaces', () => {
return {
lo:
[ { address: '127.0.0.1',
family: 'IPv4',
internal: true } ],
utun0:
[ { address: 'fe80::696:ad3d:eeec:1722',
family: 'IPv6',
internal: false } ],
[{ address: '127.0.0.1',
family: 'IPv4',
internal: true }],
utun0:
[{ address: 'fe80::696:ad3d:eeec:1722',
family: 'IPv6',
internal: false }],
utun1:
[ { address: '10.206.52.79',
family: 'IPv4',
internal: false } ] };
[{ address: '10.206.52.79',
family: 'IPv4',
internal: false }] };
});
assert.strictEqual(address.ip('utun'), '10.206.52.79');
assert.strictEqual(address.ipv6('utun'), 'fe80::696:ad3d:eeec:1722');
Expand Down

0 comments on commit 36b30d3

Please sign in to comment.