-
Notifications
You must be signed in to change notification settings - Fork 2
199 lines (193 loc) · 7.06 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Release
on:
workflow_dispatch:
jobs:
build_web_map_editor:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: huiyadanli/bettergi-map
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm install
- run: npm run build:single
- uses: actions/upload-artifact@v4
with:
name: web_map_editor
path: dist/
build_web_scripts_list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: huiyadanli/bettergi-scripts-web
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm install
- run: npm run build:single
- uses: actions/upload-artifact@v4
with:
name: web_scripts_list
path: dist/
build_dist:
runs-on: windows-latest
needs: [build_web_map_editor, build_web_scripts_list]
outputs:
version: ${{ steps.extract_version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
repository: babalae/better-genshin-impact
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/BetterGenshinImpact.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: 📝 Extract version number
id: extract_version
shell: pwsh
run: |
$xmlContent = Get-Content BetterGenshinImpact/BetterGenshinImpact.csproj
$version = ($xmlContent | Select-String -Pattern 'AssemblyVersion\>(.*)\<\/AssemblyVersion').Matches.Groups[1].Value
echo "version=$version" >> $env:GITHUB_OUTPUT
echo "::notice::Version number is: $version"
- name: 🛠️ Build application
run: dotnet publish BetterGenshinImpact/BetterGenshinImpact.csproj -c Release -p:PublishProfile=FolderProfile
continue-on-error: true
- name: 🧹 Clear & Move Files
run: |
$sourceDir = ".\BetterGenshinImpact\bin\x64\Release\net8.0-windows10.0.22621.0\publish\win-x64"
Get-ChildItem -Path $sourceDir -Recurse -Filter "*.lib" | Remove-Item -Force
Get-ChildItem -Path $sourceDir -Recurse -Filter "*ffmpeg*.dll" | Remove-Item -Force
Get-ChildItem -Path $sourceDir -Recurse -Filter "*.pdb" | Remove-Item -Force
New-Item -Path "dist/BetterGI" -ItemType Directory
xcopy "$sourceDir\*" ".\dist\BetterGI\" /E /H /I /Y
# 下载前面构建好的web内容
- uses: actions/download-artifact@v4
with:
name: web_map_editor
path: dist/BetterGI/Assets/Map/Editor
- uses: actions/download-artifact@v4
with:
name: web_scripts_list
path: dist/BetterGI/Assets/Web/ScriptRepo
# 下载构建 repo 的内容补充数据
- uses: actions/checkout@v4
with:
repository: babalae/bettergi-publish
path: publish
- name: 🗜️ Extract Map
run: |
cd publish
Get-ChildItem -Filter *.zst | ForEach-Object {
if ($_.PSIsContainer -eq $false) {
$file = $_.Name
$output_file = "..\dist\BetterGI\Assets\Map\$($file -replace '.zst$', '')"
& zstd -d $file -o $output_file
Write-Host "$file -> $output_file"
}
}
# 生成更新器
- name: 📥 Download kachina-builder
uses: robinraju/[email protected]
with:
repository: "YuehaiTeam/kachina-installer"
latest: true
fileName: "kachina-builder.exe"
- name: 📦 Gen Updater by kachina-builder
run: |
cd dist
..\kachina-builder.exe pack -c ..\publish\kachina.config.json -o BetterGI/BetterGI.update.exe
# 打包上传
- name: 📦 Generate archive
run: |
cd dist
7z a "BetterGI_v${{ steps.extract_version.outputs.version }}.7z" BetterGI -t7z -mx=5 -mf=BCJ2 -r -y
- uses: actions/upload-artifact@v4
with:
name: BetterGI_7z
path: dist/BetterGI_*.7z
build_installer:
runs-on: windows-latest
needs: [build_dist]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: BetterGI_7z
path: dist
- name: Unpack BetterGI_*.7z
run: |
cd dist
7z x "BetterGI_v${{ needs.build_dist.outputs.version }}.7z"
- name: 📥 Download kachina-builder
uses: robinraju/[email protected]
with:
repository: "YuehaiTeam/kachina-installer"
latest: true
fileName: "kachina-builder.exe"
- name: 📦 Pack kachina-builder
run: |
cd dist
..\kachina-builder.exe gen -i BetterGI -m metadata.json -o hashed -r babalae/bettergi -t ${{ needs.build_dist.outputs.version }} --diff-ignore *[.txt,.onnx]
..\kachina-builder.exe pack -c ../kachina.config.json -m metadata.json -d hashed -o BetterGI.Install.${{ needs.build_dist.outputs.version }}.exe
- name: 📦 Generate archive
run: |
cd dist
7z a dfs.tar hashed/ metadata.json -r -y
- uses: actions/upload-artifact@v4
with:
name: dfs
path: dist/dfs.tar
- uses: actions/upload-artifact@v4
with:
name: BetterGI_Install
path: dist/BetterGI.Install.*.exe
build_setup:
runs-on: windows-latest
needs: [build_dist]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: BetterGI_7z
path: dist
- name: Unpack BetterGI_*.7z
run: |
cd dist
7z x "BetterGI_v${{ needs.build_dist.outputs.version }}.7z"
- name: 📥 Download MicaSetup
# run: |
# $response = Invoke-RestMethod -Uri "https://api.github.com/repos/lemutec/MicaSetup/releases/latest"
# $downloadUrl = $response.assets | Where-Object { $_.name -like "MicaSetup_v*.7z" } | Select-Object -ExpandProperty browser_download_url
# $zipFilePath = "MicaSetup.7z"
# Invoke-WebRequest -Uri $downloadUrl -OutFile $zipFilePath
# 7z x $zipFilePath
uses: robinraju/[email protected]
with:
repository: "lemutec/MicaSetup"
latest: true
fileName: "MicaSetup_v*.7z"
- name: 📦 Pack MicaSetup
run: |
$archiveFiles = Get-ChildItem -Path . -Filter "MicaSetup_v*.7z"
foreach ($archive in $archiveFiles) {
& 7z x $archive.FullName
}
7z a -t7z "publish.7z" dist/BetterGI/*
.\makemica.exe micasetup.json
ren BetterGI_Setup.exe BetterGI_Setup_v${{ needs.build_dist.outputs.version }}.exe
- uses: actions/upload-artifact@v4
with:
name: BetterGI_Setup
path: BetterGI_Setup*.exe