Skip to content

Commit 4ba66c6

Browse files
committed
Add auto publish release github action
1 parent 6ce07ea commit 4ba66c6

File tree

3 files changed

+62
-47
lines changed

3 files changed

+62
-47
lines changed

.github/workflows/dotnet.yml

+38-46
Original file line numberDiff line numberDiff line change
@@ -5,57 +5,49 @@ name: .NET
55

66
on:
77
push:
8-
branches: [ "main" ]
8+
branches: ["main"]
99
pull_request:
10-
branches: [ "main" ]
10+
branches: ["main"]
1111

1212
jobs:
1313
build:
14-
1514
runs-on: windows-latest
1615

1716
steps:
18-
19-
- uses: actions/checkout@v4
20-
- name: Setup .NET
21-
uses: actions/setup-dotnet@v4
22-
with:
23-
dotnet-version: 7.0.x
24-
25-
26-
- name: Get Commit short hash
27-
id: vars
28-
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
29-
shell: bash
30-
31-
- name: Restore dependencies and build
32-
run: |
33-
dotnet restore
34-
dotnet publish /p:OutputType=WinExe
35-
36-
- name: Create Artifact
37-
run: |
38-
cp -r ./glossaries ./db changelog.md oo2core_6_win64.dll ./bin/Release/net7.0-windows/publish
39-
#7z a SoulsModTranslator-${{steps.vars.outputs.sha_short}}.zip ./bin/Release/net7.0-windows/publish
40-
shell: bash
41-
42-
- uses: actions/upload-artifact@v4
17+
- uses: actions/checkout@v4
18+
- name: Setup .NET
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: 7.0.x
22+
23+
- name: Get Commit short hash
24+
id: vars
25+
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
26+
run: echo "latest_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
27+
shell: bash
28+
29+
- name: Restore dependencies and build
30+
run: |
31+
dotnet restore
32+
dotnet publish /p:OutputType=WinExe
33+
34+
- name: Create Artifact
35+
run: |
36+
cp -r ./glossaries ./db changelog.md oo2core_6_win64.dll ./bin/Release/net7.0-windows/publish
37+
#7z a SoulsModTranslator${{steps.vars.outputs.latest_tag}}.zip ./bin/Release/net7.0-windows/publish
38+
python create_release_note.py
39+
shell: bash
40+
41+
- uses: actions/upload-artifact@v4
42+
with:
43+
name: SoulsModTranslator-${{steps.vars.outputs.sha_short}}
44+
path: ./bin/Release/net7.0-windows/publish
45+
46+
- name: Release
47+
uses: softprops/action-gh-release@v2
48+
if: startsWith(github.ref, 'refs/tags/')
4349
with:
44-
name: SoulsModTranslator-${{steps.vars.outputs.sha_short}}
45-
path: ./bin/Release/net7.0-windows/publish
46-
47-
48-
49-
# - name: Release
50-
# uses: softprops/action-gh-release@v2
51-
# if: startsWith(github.ref, 'refs/tags/')
52-
# with:
53-
# body_path: ${{ github.workspace }}-CHANGELOG.txt
54-
# files: |
55-
# ${{steps.vars2.outputs.archive_name}}.zip
56-
# repository: hhhxiao/SoulsModTranslator
57-
58-
59-
60-
61-
50+
body_path: ${{ github.workspace }}/release_note
51+
files: |
52+
SoulsModTranslator${{steps.vars.outputs.latest_tag}}.zip
53+
repository: hhhxiao/SoulsModTranslator

changelog.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
## v2.1
1+
### v2.3
2+
3+
- 为词汇表替换添加正则匹配功能
4+
- 添加自动构建功能
5+
- 优化代码架构,为支持其他语言做准备
6+
7+
### v2.1
28

39
- 修复一个可能的闪退
410
- 修复黑魂 3 数据库错误和数据库导出的一个问题

create_release_note.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if __name__ == "__main__":
2+
total = ""
3+
with open("changelog.md", encoding="utf-8") as f:
4+
total = f.readlines()
5+
content = ""
6+
index = 0
7+
for x in total:
8+
x = x.strip()
9+
if len(x) != 0:
10+
tokens = x.split(" ")
11+
if tokens[0] == "###":
12+
index += 1
13+
if index == 2:
14+
break
15+
content += x + "\n"
16+
with open("release_note", "w", encoding="utf-8") as f:
17+
f.write(content)

0 commit comments

Comments
 (0)