Skip to content

Commit 23f869a

Browse files
LightLight
Light
authored and
Light
committed
chore(release): 添加 Github Actions
1 parent f37ba98 commit 23f869a

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
types: [
3+
{
4+
types: ['feat', 'feature'],
5+
label: '新功能',
6+
},
7+
{
8+
types: ['fix', 'bugfix'],
9+
label: '问题修复',
10+
},
11+
{
12+
types: ['perf'],
13+
label: '优化',
14+
},
15+
{
16+
types: ['refactor'],
17+
label: '重构',
18+
},
19+
{
20+
types: ['build', 'ci'],
21+
label: '构建',
22+
},
23+
],
24+
excludeTypes: ['other', 'docs', 'style', 'test', 'chore'],
25+
};

.github/workflows/build-release.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: build-release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout/@v3
15+
- name: Set Up Python 3.9
16+
uses: actions/setup-python/@v3
17+
with:
18+
python-version: '3.9'
19+
- name: Install Dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
- name: Read Name
23+
id: read_name
24+
uses: ashley-taylor/[email protected]
25+
with:
26+
path: ./info.json
27+
property: name
28+
- name: Read Version
29+
id: read_version
30+
uses: ashley-taylor/[email protected]
31+
with:
32+
path: ./info.json
33+
property: version
34+
- name: Build Package
35+
run: python build.py
36+
- name: Create ChangeLog Text
37+
id: changelog_text
38+
uses: loopwerk/tag-changelog@v1
39+
with:
40+
token: ${{ secrets.GITHUB_TOKEN }}
41+
config_file: .github/scripts/tag-changelog-config.js
42+
- name: Create Release
43+
id: create_release
44+
uses: actions/create-release@v1
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
with:
48+
tag_name: ${{ github.ref }}
49+
release_name: Release ${{ github.ref }}
50+
body: ${{ steps.changelog_text.outputs.changes }}
51+
draft: false
52+
prerelease: false
53+
- name: Upload Release Tar Asset
54+
id: upload_release_tar_asset
55+
uses: actions/upload-release-asset@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
upload_url: ${{ steps.create_release.outputs.upload_url }}
60+
asset_path: ./build/${{ steps.read_name.outputs.value }}_v${{ steps.read_version.outputs.value }}.tar.gz
61+
asset_name: ${{ steps.read_name.outputs.value }}_v${{ steps.read_version.outputs.value }}.tar.gz
62+
asset_content_type: application/gzip
63+
- name: Upload Release Zip Asset
64+
id: upload_release_zip_asset
65+
uses: actions/upload-release-asset@v1
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
upload_url: ${{ steps.create_release.outputs.upload_url }}
70+
asset_path: ./build/${{ steps.read_name.outputs.value }}_v${{ steps.read_version.outputs.value }}.zip
71+
asset_name: ${{ steps.read_name.outputs.value }}_v${{ steps.read_version.outputs.value }}.zip
72+
asset_content_type: application/zip

0 commit comments

Comments
 (0)