Skip to content

Commit 51ddfb4

Browse files
committed
chore: init
0 parents  commit 51ddfb4

23 files changed

+1227
-0
lines changed

.editorconfig

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

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/*

.eslintrc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
commonjs: true,
6+
es2021: true,
7+
node: true,
8+
},
9+
extends: ['prettier'],
10+
parserOptions: {
11+
ecmaVersion: 13,
12+
},
13+
plugins: ['prettier'],
14+
rules: {
15+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
16+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
17+
'prettier/prettier': 'warn',
18+
},
19+
}

.github/workflows/auto-pr.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Auto PR
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
7+
jobs:
8+
auto-pr:
9+
runs-on: ubuntu-latest
10+
steps:
11+
# 获取目标分支源码
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
# 需要指定目标分支
16+
ref: main
17+
# 重置源分支以便运用新的更改
18+
- name: Reset Develop Branch
19+
run: |
20+
git fetch origin develop:develop
21+
git reset --hard develop
22+
# 自动发起 PR
23+
- name: Create Pull Request
24+
uses: peter-evans/create-pull-request@v3
25+
with:
26+
branch: develop
27+
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
28+
title: 'chore: release next version'
29+
commit-message: 'chore: release next version'

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
types: [closed]
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
# 获取源码
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
# 查找yarn缓存
16+
- name: Get yarn cache path
17+
id: yarn-cache
18+
run: echo "::set-output name=dir::$(yarn cache dir)"
19+
# 更新缓存
20+
- name: Cache dependencies
21+
uses: actions/cache@v1
22+
with:
23+
path: ${{ steps.yarn-cache.outputs.dir }}
24+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
25+
restore-keys: |
26+
${{ runner.os }}-yarn-
27+
# 安装依赖并打包
28+
- name: Install and build
29+
run: |
30+
yarn global add pkg @semantic-release/changelog @semantic-release/git
31+
yarn install
32+
yarn build
33+
# 压缩构建后的文件
34+
- name: Compress
35+
run: |
36+
zip --junk-paths Git_Log_Analytics_win dist/Git_Log_Analytics_win.exe
37+
zip --junk-paths Git_Log_Analytics_mac dist/Git_Log_Analytics_mac.dmg
38+
# 发版
39+
- name: Release
40+
id: create_release
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
43+
run: npx semantic-release
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Upload Release Asset
2+
3+
on: release
4+
5+
jobs:
6+
upload-release-asset:
7+
runs-on: ubuntu-latest
8+
steps:
9+
# 获取源码
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
with:
13+
# 需要指定目标分支
14+
ref: main
15+
# 从 package.json 读取版本号
16+
- name: Get NPM Version
17+
id: package-version
18+
uses: martinbeentjes/npm-get-version-action@master
19+
# 文件改名,加入版本号
20+
- name: Rename Files
21+
run: |
22+
mv Git_Log_Analytics_win.zip Git_Log_Analytics_v${{ steps.package-version.outputs.current-version}}_win.zip
23+
mv Git_Log_Analytics_mac.zip Git_Log_Analytics_v${{ steps.package-version.outputs.current-version}}_mac.zip
24+
# 上传 Win 版本的压缩包到 release
25+
- name: Upload to release
26+
uses: JasonEtco/upload-to-release@master
27+
with:
28+
args: Git_Log_Analytics_v${{ steps.package-version.outputs.current-version}}_win.zip application/zip
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
31+
# 删除 Win 版本的压缩包
32+
- name: Remove Files
33+
uses: JesseTG/rm@v1.0.2
34+
with:
35+
path: Git_Log_Analytics_v${{ steps.package-version.outputs.current-version}}_win.zip
36+
# 上传 Mac 版本的压缩包到 release
37+
- name: Upload to release
38+
uses: JasonEtco/upload-to-release@master
39+
with:
40+
args: Git_Log_Analytics_v${{ steps.package-version.outputs.current-version}}_mac.zip application/zip
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
43+
# 删除 Mac 版本的压缩包
44+
- name: Remove Files
45+
uses: JesseTG/rm@v1.0.2
46+
with:
47+
path: Git_Log_Analytics_v${{ steps.package-version.outputs.current-version}}_mac.zip
48+
# 提交代码
49+
- name: Save Changes
50+
run: |
51+
git config user.email "chengpeiquan@chengpeiquan.com"
52+
git config user.name "chengpeiquan"
53+
git add .
54+
git commit -m "chore: remove artifacts"
55+
git push

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
node_modules
3+
*.exe
4+
*.rar
5+
report.txt

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.md

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true
4+
}

.releaserc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"branches": "main",
3+
"ci": false,
4+
"plugins": [
5+
"@semantic-release/commit-analyzer",
6+
"@semantic-release/release-notes-generator",
7+
"@semantic-release/changelog",
8+
[
9+
"@semantic-release/git",
10+
{
11+
"assets": [
12+
"Git_Log_Analytics_win.zip",
13+
"Git_Log_Analytics_mac.zip",
14+
"package.json",
15+
"CHANGELOG.md"
16+
],
17+
"message": "release: v${nextRelease.version}\n\n${nextRelease.notes}"
18+
}
19+
],
20+
"@semantic-release/github"
21+
]
22+
}

0 commit comments

Comments
 (0)