Skip to content

Commit 6c580b1

Browse files
committed
使用产品版本号,本地版本号改成0.0.1
1 parent 527dd98 commit 6c580b1

File tree

4 files changed

+384
-9
lines changed

4 files changed

+384
-9
lines changed

.github/workflows/publish.yml

Lines changed: 369 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,369 @@
1+
name: BetterGI Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'BetterGI Version (eg: v0.35.1, v0.36.5-alpha.1)'
8+
required: true
9+
type: string
10+
kachina-channel:
11+
type: choice
12+
description: 'Kachina Installer Channel'
13+
required: true
14+
default: 'release'
15+
options:
16+
- release
17+
- dev
18+
push:
19+
tags:
20+
- 'v[0-9]+.[0-9]+.[0-9]+*'
21+
22+
jobs:
23+
# Add validation job to check version format
24+
validate:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
version: ${{ steps.set-version.outputs.version }}
28+
steps:
29+
- name: Set version from input or tag
30+
id: set-version
31+
run: |
32+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
33+
# Validate manual input version format
34+
if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then
35+
echo "Error: Version must follow semantic versioning (e.g., 1.2.3, 1.2.3-alpha, 1.2.3+build.123)"
36+
exit 1
37+
fi
38+
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
39+
else
40+
# Extract version from tag name (remove 'v' prefix)
41+
VERSION=${GITHUB_REF#refs/tags/v}
42+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
43+
fi
44+
45+
build_web_map_editor:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
repository: huiyadanli/bettergi-map
51+
- uses: actions/setup-node@v4
52+
with:
53+
node-version: 20
54+
cache: 'npm'
55+
- run: npm install
56+
- run: npm run build:single
57+
- uses: actions/upload-artifact@v4
58+
with:
59+
name: web_map_editor
60+
path: dist/
61+
62+
build_web_scripts_list:
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
with:
67+
repository: huiyadanli/bettergi-scripts-web
68+
- uses: actions/setup-node@v4
69+
with:
70+
node-version: 20
71+
cache: 'npm'
72+
- run: npm install
73+
- run: npm run build:single
74+
- uses: actions/upload-artifact@v4
75+
with:
76+
name: web_scripts_list
77+
path: dist/
78+
79+
build_dist:
80+
runs-on: windows-latest
81+
needs: [validate, build_web_map_editor, build_web_scripts_list]
82+
steps:
83+
- uses: actions/checkout@v4
84+
with:
85+
repository: babalae/better-genshin-impact
86+
- uses: actions/setup-dotnet@v4
87+
with:
88+
dotnet-version: 8.x
89+
- name: Cache NuGet packages
90+
uses: actions/cache@v4
91+
with:
92+
path: ~/.nuget/packages
93+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/BetterGenshinImpact.csproj') }}
94+
restore-keys: |
95+
${{ runner.os }}-nuget-
96+
- name: 🛠️ Build application
97+
run: dotnet publish BetterGenshinImpact/BetterGenshinImpact.csproj -c Release -p:PublishProfile=FolderProfile -p:Version=${{ needs.validate.outputs.version }}
98+
continue-on-error: true
99+
- name: 🧹 Clear & Move Files
100+
run: |
101+
$sourceDir = ".\BetterGenshinImpact\bin\x64\Release\net8.0-windows10.0.22621.0\publish\win-x64"
102+
Get-ChildItem -Path $sourceDir -Recurse -Filter "*.lib" | Remove-Item -Force
103+
Get-ChildItem -Path $sourceDir -Recurse -Filter "*ffmpeg*.dll" | Remove-Item -Force
104+
Get-ChildItem -Path $sourceDir -Recurse -Filter "*.pdb" | Remove-Item -Force
105+
New-Item -Path "dist/BetterGI" -ItemType Directory
106+
xcopy "$sourceDir\*" ".\dist\BetterGI\" /E /H /I /Y
107+
# 下载前面构建好的web内容
108+
- uses: actions/download-artifact@v4
109+
with:
110+
name: web_map_editor
111+
path: dist/BetterGI/Assets/Map/Editor
112+
- uses: actions/download-artifact@v4
113+
with:
114+
name: web_scripts_list
115+
path: dist/BetterGI/Assets/Web/ScriptRepo
116+
# 下载构建 repo 的内容补充数据
117+
- uses: actions/checkout@v4
118+
with:
119+
repository: babalae/bettergi-publish
120+
path: publish
121+
- name: 🗜️ Extract Map
122+
run: |
123+
cd publish
124+
# Extract zst files
125+
Get-ChildItem -Filter *.zst | ForEach-Object {
126+
if ($_.PSIsContainer -eq $false) {
127+
$file = $_.Name
128+
$output_file = "..\dist\BetterGI\Assets\Map\$($file -replace '.zst$', '')"
129+
& zstd -d $file -o $output_file
130+
Write-Host "$file -> $output_file"
131+
}
132+
}
133+
# Extract zip files
134+
Get-ChildItem -Filter *.zip | ForEach-Object {
135+
if ($_.PSIsContainer -eq $false) {
136+
$file = $_.FullName
137+
$destination = "..\dist\BetterGI\Assets\Map"
138+
Expand-Archive -Path $file -DestinationPath $destination -Force
139+
Write-Host "$file -> $destination"
140+
}
141+
}
142+
# 生成更新器
143+
- name: 📥 Download kachina-builder release
144+
if: ${{ github.event.inputs.kachina-channel == 'release' }}
145+
uses: robinraju/release-downloader@v1.8
146+
with:
147+
repository: "YuehaiTeam/kachina-installer"
148+
latest: true
149+
fileName: "kachina-builder.exe"
150+
151+
- name: 📥 Download kachina-builder dev
152+
if: ${{ github.event.inputs.kachina-channel == 'dev' }}
153+
uses: dawidd6/action-download-artifact@v8
154+
with:
155+
github_token: ${{secrets.GITHUB_TOKEN}}
156+
repo: "YuehaiTeam/kachina-installer"
157+
workflow: "build.yml"
158+
name: artifact
159+
branch: main
160+
event: push
161+
workflow_conclusion: success
162+
- name: 📦 Gen Updater by kachina-builder
163+
run: |
164+
cd dist
165+
..\kachina-builder.exe pack -c ..\publish\kachina.config.json -o BetterGI/BetterGI.update.exe
166+
# 打包上传
167+
- name: 📦 Generate archive
168+
run: |
169+
cd dist
170+
7z a "BetterGI_v${{ needs.validate.outputs.version }}.7z" BetterGI -t7z -mx=5 -mf=BCJ2 -r -y
171+
- uses: actions/upload-artifact@v4
172+
with:
173+
name: BetterGI_7z
174+
path: dist/BetterGI_*.7z
175+
176+
build_installer:
177+
runs-on: windows-latest
178+
needs: [build_dist]
179+
steps:
180+
- uses: actions/checkout@v4
181+
- uses: actions/download-artifact@v4
182+
with:
183+
name: BetterGI_7z
184+
path: dist
185+
- name: Unpack BetterGI_*.7z
186+
run: |
187+
cd dist
188+
7z x "BetterGI_v${{ needs.validate.outputs.version }}.7z"
189+
- name: 📥 Download kachina-builder release
190+
if: ${{ github.event.inputs.kachina-channel == 'release' }}
191+
uses: robinraju/release-downloader@v1.8
192+
with:
193+
repository: "YuehaiTeam/kachina-installer"
194+
latest: true
195+
fileName: "kachina-builder.exe"
196+
- name: 📥 Download kachina-builder dev
197+
if: ${{ github.event.inputs.kachina-channel == 'dev' }}
198+
uses: dawidd6/action-download-artifact@v8
199+
with:
200+
github_token: ${{secrets.GITHUB_TOKEN}}
201+
repo: "YuehaiTeam/kachina-installer"
202+
workflow: "build.yml"
203+
name: artifact
204+
branch: main
205+
event: push
206+
workflow_conclusion: success
207+
- name: 📥 Download last release
208+
uses: robinraju/release-downloader@v1.8
209+
with:
210+
repository: "babalae/better-genshin-impact"
211+
latest: true
212+
fileName: "BetterGI_v*.7z"
213+
out-file-path: 'last'
214+
- name: 📥 Get 2nd and 3rd release
215+
id: release_tags
216+
env:
217+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
218+
run: |
219+
$releasesUrl = "https://api.github.com/repos/babalae/better-genshin-impact/releases"
220+
$headers = @{
221+
"Authorization" = "Bearer $env:GITHUB_TOKEN"
222+
"Accept" = "application/vnd.github.v3+json"
223+
}
224+
$releases = Invoke-RestMethod -Uri $releasesUrl -Headers $headers -Method Get
225+
$validReleases = $releases |
226+
Where-Object { -not $_.draft -and -not $_.prerelease } |
227+
Sort-Object { [DateTime]$_.published_at } -Descending
228+
if ($validReleases.Count -lt 3) {
229+
Write-Error "至少需要 3 个正式 Release(当前找到 $($validReleases.Count) 个)"
230+
exit 1
231+
}
232+
"second_release_tag=$($validReleases[1].tag_name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
233+
"third_release_tag=$($validReleases[2].tag_name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
234+
235+
- name: 📥 Download 2nd last release
236+
uses: robinraju/release-downloader@v1.8
237+
with:
238+
repository: "babalae/better-genshin-impact"
239+
tag: ${{ steps.release_tags.outputs.second_release_tag }}
240+
fileName: "BetterGI_v*.7z"
241+
out-file-path: '2nd'
242+
- name: 📥 Download 3rd last release
243+
uses: robinraju/release-downloader@v1.8
244+
with:
245+
repository: "babalae/better-genshin-impact"
246+
tag: ${{ steps.release_tags.outputs.third_release_tag }}
247+
fileName: "BetterGI_v*.7z"
248+
out-file-path: '3rd'
249+
- name: Unpack releases
250+
run: |
251+
cd last
252+
7z x "BetterGI*.7z" -otemp
253+
if (Test-Path -Path ".\temp\BetterGI" -PathType Container) {
254+
Move-Item -Path ".\temp\BetterGI" -Destination ".\BetterGI"
255+
} else {
256+
Rename-Item -Path ".\temp" -NewName ".\BetterGI"
257+
}
258+
cd ..
259+
cd 2nd
260+
7z x "BetterGI*.7z" -otemp
261+
if (Test-Path -Path ".\temp\BetterGI" -PathType Container) {
262+
Move-Item -Path ".\temp\BetterGI" -Destination ".\BetterGI"
263+
} else {
264+
Rename-Item -Path ".\temp" -NewName ".\BetterGI"
265+
}
266+
cd ..
267+
cd 3rd
268+
7z x "BetterGI*.7z" -otemp
269+
if (Test-Path -Path ".\temp\BetterGI" -PathType Container) {
270+
Move-Item -Path ".\temp\BetterGI" -Destination ".\BetterGI"
271+
} else {
272+
Rename-Item -Path ".\temp" -NewName ".\BetterGI"
273+
}
274+
cd ..
275+
ls .\last
276+
ls .\2nd
277+
ls .\3rd
278+
- name: 📦 Pack kachina-builder
279+
run: |
280+
cd dist
281+
..\kachina-builder.exe gen -j 6 -i BetterGI -m metadata.json -o hashed -r babalae/bettergi -t ${{ needs.validate.outputs.version }} --diff-vers ..\last\BetterGI --diff-vers ..\2nd\BetterGI --diff-vers ..\3rd\BetterGI --diff-ignore *[.txt,.onnx] -u .\BetterGI\BetterGI.update.exe
282+
..\kachina-builder.exe pack -c ../kachina.config.json -m metadata.json -d hashed -o BetterGI.Install.${{ needs.validate.outputs.version }}.exe
283+
- uses: actions/upload-artifact@v4
284+
with:
285+
name: BetterGI_Install
286+
path: dist/BetterGI.Install.*.exe
287+
- uses: actions/upload-artifact@v4
288+
with:
289+
name: BetterGI_Metadata
290+
path: dist/metadata.json
291+
292+
build_setup:
293+
runs-on: windows-latest
294+
needs: [build_dist]
295+
steps:
296+
- uses: actions/checkout@v4
297+
- uses: actions/download-artifact@v4
298+
with:
299+
name: BetterGI_7z
300+
path: dist
301+
- name: Unpack BetterGI_*.7z & Repack
302+
run: |
303+
cd dist
304+
7z x "BetterGI_v${{ needs.validate.outputs.version }}.7z"
305+
cd BetterGI
306+
7z a -t7z "..\..\publish.7z" *
307+
- name: 📥 Download MicaSetup
308+
uses: robinraju/release-downloader@v1.8
309+
with:
310+
repository: "lemutec/MicaSetup"
311+
latest: true
312+
fileName: "MicaSetup_v*.7z"
313+
- name: 📦 Pack MicaSetup
314+
run: |
315+
$archiveFiles = Get-ChildItem -Path . -Filter "MicaSetup_v*.7z"
316+
foreach ($archive in $archiveFiles) {
317+
& 7z x $archive.FullName
318+
}
319+
.\makemica.exe micasetup.json
320+
ren BetterGI_Setup.exe BetterGI_Setup_v${{ needs.validate.outputs.version }}.exe
321+
- uses: actions/upload-artifact@v4
322+
with:
323+
name: BetterGI_Setup
324+
path: BetterGI_Setup*.exe
325+
326+
mirrorchyan_uploading:
327+
if: github.repository_owner == 'babalae'
328+
needs: [build_dist, build_installer]
329+
runs-on: macos-latest
330+
steps:
331+
332+
- uses: actions/download-artifact@v4
333+
with:
334+
path: downloads
335+
github-token: ${{ secrets.GITHUB_TOKEN }}
336+
337+
- name: Extract 7z
338+
shell: bash
339+
run: |
340+
cd downloads/BetterGI_7z
341+
7z x BetterGI_v*.7z -oun7z
342+
mv ../BetterGI_Metadata/metadata.json ./un7z/BetterGI/.metadata.json
343+
344+
- name: Upload Zip
345+
uses: MirrorChyan/uploading-action@v1
346+
with:
347+
filetype: local
348+
mirrorchyan_rid: BGI
349+
working-directory: downloads/BetterGI_7z/un7z/
350+
pick_files: '["BetterGI"]'
351+
version_name: ${{ needs.validate.outputs.version }}
352+
upload_token: ${{ secrets.MirrorChyanUploadToken }}
353+
auto_channel: false
354+
channel: beta
355+
356+
- name: Upload Install.exe
357+
uses: MirrorChyan/uploading-action@v1
358+
with:
359+
filetype: local
360+
mirrorchyan_rid: BGI
361+
working-directory: downloads/BetterGI_Install/
362+
filename: "BetterGI.Install.*.exe"
363+
extra_zip: true
364+
version_name: ${{ needs.validate.outputs.version }}
365+
upload_token: ${{ secrets.MirrorChyanUploadToken }}
366+
auto_channel: false
367+
channel: beta
368+
os: win
369+
arch: x64

BetterGenshinImpact/BetterGenshinImpact.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4+
<AssemblyName>BetterGI</AssemblyName>
5+
<Version>0.0.1</Version>
6+
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
47
<OutputType>WinExe</OutputType>
58
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
69
<Nullable>enable</Nullable>
@@ -9,8 +12,6 @@
912
<LangVersion>12.0</LangVersion>
1013
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1114
<ApplicationIcon>Assets\Images\logo.ico</ApplicationIcon>
12-
<AssemblyName>BetterGI</AssemblyName>
13-
<AssemblyVersion>0.45.0</AssemblyVersion>
1415
<Platforms>x64</Platforms>
1516
<DebugType>embedded</DebugType>
1617
</PropertyGroup>
@@ -67,6 +68,7 @@
6768
<PackageReference Include="Sdcb.PaddleInference.runtime.win64.openblas" Version="2.6.1" />
6869
<PackageReference Include="Sdcb.PaddleOCR" Version="2.7.0.3" />
6970
<PackageReference Include="Sdl.MultiSelectComboBox" Version="1.0.103" />
71+
<PackageReference Include="Semver" Version="3.0.0" />
7072
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
7173
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
7274
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />

0 commit comments

Comments
 (0)