Skip to content

Commit d08f1b8

Browse files
committed
chore: add auto release ci
1 parent 525d3c4 commit d08f1b8

File tree

10 files changed

+140
-23
lines changed

10 files changed

+140
-23
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
indent_size = 2
11+
indent_style = space
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.eslintignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
coverage
22
dist
33
node_modules
4-
lib
4+
example
5+
*.test.js
6+
lib

.eslintrc.js

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module.exports = {
6666
],
6767
semi: ['error', 'never'],
6868
'spaced-comment': 'error',
69-
strict: ['error', 'never'],
69+
strict: ['error', 'global'],
7070
'prettier/prettier': 'error'
7171
}
7272
}

.prettierignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
coverage
2-
dist
3-
node_modules
1+
CHANGELOG.md
2+
*.test.js

.travis.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
language: node_js
22

33
node_js:
4-
- '8'
4+
- 8
5+
- 10
56

67
install:
78
- npm install
89

9-
script:
10-
- npm test
10+
jobs:
11+
include:
12+
# Define the release stage that runs semantic-release
13+
- stage: release
14+
node_js: 10.18
15+
# Advanced: optionally overwrite your default `script` step to skip the tests
16+
# script: skip
17+
deploy:
18+
provider: script
19+
skip_cleanup: true
20+
on:
21+
branch: master
22+
script:
23+
- npm run release

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019-present TencentCloud
3+
Copyright (c) 2019-present Tencent Cloud, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 腾讯云 SDK
22

3-
## 云API 接口使用方法
3+
## 云 API 接口使用方法
44

55
```
66
const { apigw } = require('../lib/index')

package.json

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,33 @@
1212
"Cloud function"
1313
],
1414
"scripts": {
15-
"test": "npm run lint",
15+
"test": "npm run lint && npm run prettier",
1616
"commitlint": "commitlint -f HEAD@{15}",
1717
"lint": "eslint --ext .js,.ts,.tsx .",
18-
"lint:fix": "eslint --fix --ext .js,.ts,.tsx ."
18+
"lint:fix": "eslint --fix --ext .js,.ts,.tsx .",
19+
"prettier": "prettier --check **/*.{css,html,js,json,md,yaml,yml}",
20+
"prettier:fix": "prettier --write **/*.{css,html,js,json,md,yaml,yml}",
21+
"release": "semantic-release",
22+
"release-local": "node -r dotenv/config node_modules/semantic-release/bin/semantic-release --no-ci --dry-run",
23+
"check-dependencies": "npx npm-check --skip-unused --update"
24+
},
25+
"engines": {
26+
"node": ">=10.18"
1927
},
2028
"husky": {
2129
"hooks": {
2230
"pre-commit": "lint-staged",
2331
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
24-
"pre-push": "npm run lint"
32+
"pre-push": "npm run lint:fix && npm run prettier:fix"
2533
}
2634
},
2735
"lint-staged": {
2836
"**/*.{js,ts,tsx}": [
29-
"npm run lint",
37+
"npm run lint:fix",
38+
"git add ."
39+
],
40+
"**/*.{css,html,js,json,md,yaml,yml}": [
41+
"npm run prettier:fix",
3042
"git add ."
3143
]
3244
},
@@ -61,13 +73,31 @@
6173
"devDependencies": {
6274
"@commitlint/cli": "^8.3.5",
6375
"@commitlint/config-conventional": "^8.3.4",
64-
"babel-eslint": "9.0.0",
65-
"eslint": "5.6.0",
66-
"eslint-config-prettier": "^3.6.0",
67-
"eslint-plugin-import": "^2.18.0",
68-
"eslint-plugin-prettier": "^3.0.1",
69-
"husky": "^4.2.5",
70-
"lint-staged": "^10.2.2",
71-
"prettier": "^1.18.2"
72-
}
76+
"@semantic-release/changelog": "^5.0.0",
77+
"@semantic-release/commit-analyzer": "^8.0.1",
78+
"@semantic-release/git": "^9.0.0",
79+
"@semantic-release/npm": "^7.0.4",
80+
"@semantic-release/release-notes-generator": "^9.0.1",
81+
"babel-eslint": "^10.1.0",
82+
"dotenv": "^8.2.0",
83+
"eslint": "^6.8.0",
84+
"eslint-config-prettier": "^6.10.0",
85+
"eslint-plugin-import": "^2.20.1",
86+
"eslint-plugin-prettier": "^3.1.2",
87+
"husky": "^4.2.3",
88+
"lint-staged": "^10.0.8",
89+
"prettier": "^1.19.1",
90+
"semantic-release": "^17.0.4"
91+
},
92+
"directories": {
93+
"lib": "lib"
94+
},
95+
"repository": {
96+
"type": "git",
97+
"url": "git+https://github.com/serverless-tencent/tencent-cloud-sdk.git"
98+
},
99+
"bugs": {
100+
"url": "https://github.com/serverless-tencent/tencent-cloud-sdk/issues"
101+
},
102+
"homepage": "https://github.com/serverless-tencent/tencent-cloud-sdk#readme"
73103
}

prettier.config.js

100644100755
File mode changed.

release.config.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
module.exports = {
2+
verifyConditions: [
3+
'@semantic-release/changelog',
4+
'@semantic-release/npm',
5+
'@semantic-release/git',
6+
'@semantic-release/github'
7+
],
8+
plugins: [
9+
[
10+
'@semantic-release/commit-analyzer',
11+
{
12+
preset: 'angular',
13+
parserOpts: {
14+
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING']
15+
}
16+
}
17+
],
18+
[
19+
'@semantic-release/release-notes-generator',
20+
{
21+
preset: 'angular',
22+
parserOpts: {
23+
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING']
24+
},
25+
writerOpts: {
26+
commitsSort: ['subject', 'scope']
27+
}
28+
}
29+
],
30+
[
31+
'@semantic-release/changelog',
32+
{
33+
changelogFile: 'CHANGELOG.md'
34+
}
35+
],
36+
[
37+
'@semantic-release/npm',
38+
{
39+
pkgRoot: '.',
40+
npmPublish: true,
41+
tarballDir: false
42+
}
43+
],
44+
[
45+
'@semantic-release/git',
46+
{
47+
assets: ['package.json', 'src/**', 'CHANGELOG.md'],
48+
message: 'chore(release): version ${nextRelease.version} \n\n${nextRelease.notes}'
49+
}
50+
],
51+
[
52+
'@semantic-release/github',
53+
{
54+
assets: ['!.env']
55+
}
56+
]
57+
]
58+
}

0 commit comments

Comments
 (0)