Release #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
jobs: | |
build_main: | |
runs-on: windows-latest | |
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 Files | |
run: | | |
Get-ChildItem -Path "BetterGenshinImpact\bin\x64\Release\net8.0-windows10.0.22621.0\publish\win-x64" -Recurse -Filter "*.lib" | Remove-Item -Force | |
Get-ChildItem -Path "BetterGenshinImpact\bin\x64\Release\net8.0-windows10.0.22621.0\publish\win-x64" -Recurse -Filter "*ffmpeg*.dll" | Remove-Item -Force | |
Get-ChildItem -Path "BetterGenshinImpact\bin\x64\Release\net8.0-windows10.0.22621.0\publish\win-x64" -Recurse -Filter "*.pdb" | Remove-Item -Force | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: main | |
path: BetterGenshinImpact/bin/x64/Release/net8.0-windows10.0.22621.0/publish/win-x64/ | |
build_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: map_editor | |
path: dist/ | |
build_scripts: | |
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: scripts | |
path: dist/ | |
pack: | |
runs-on: windows-latest | |
needs: [build_main, build_map_editor, build_scripts] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: main | |
path: dist/BetterGI | |
- uses: actions/download-artifact@v4 | |
with: | |
name: map_editor | |
path: dist/BetterGI/Assets/Map/Editor | |
- uses: actions/download-artifact@v4 | |
with: | |
name: scripts | |
path: dist/BetterGI/Assets/Web/ScriptRepo | |
- name: Extract Map | |
run: | | |
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 | |
run: | | |
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/YuehaiTeam/kachina-installer/releases/latest" | |
$downloadUrl = $response.assets | Where-Object { $_.name -like "kachina-builder.exe" } | Select-Object -ExpandProperty browser_download_url | |
$zipFilePath = "kachina-builder.exe" | |
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipFilePath | |
- name: Pack kachina-builder | |
run: | | |
cd dist | |
..\kachina-builder.exe gen -i BetterGI -m metadata.json -o hashed -r babalae/bettergi -t ${{ needs.build_main.outputs.version }} --diff-ignore *[.txt,.onnx] | |
..\kachina-builder.exe pack -c ../kachina.config.json -o BetterGI/BetterGI.update.exe | |
..\kachina-builder.exe pack -c ../kachina.config.json -m metadata.json -d hashed -o BetterGI.Install.${{ needs.build_main.outputs.version }}.exe | |
- name: Generate archive | |
run: | | |
cd dist | |
7z a dfs.tar hashed/ metadata.json -r -y | |
7z a "BetterGI_v${{ needs.build_main.outputs.version }}.7z" BetterGI -t7z -mx=5 -mf=BCJ2 -r -y | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: publish | |
path: dist/BetterGI_*.7z | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dfs | |
path: dist/dfs.tar | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: installer | |
path: dist/BetterGI.Install.*.exe |