From fca69c208858db2f586b04a8f52f5eeb8f45ee55 Mon Sep 17 00:00:00 2001 From: xyToki <7547189+xytoki@users.noreply.github.com> Date: Thu, 16 Jan 2025 00:01:50 +0800 Subject: [PATCH 1/3] feat: create dfs hashed output --- .github/workflows/publish.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a7b188f..4c39b61 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -96,19 +96,10 @@ jobs: path: dist/BetterGI/Assets/Web/ScriptRepo - name: download hdiffz run: | - $response = Invoke-RestMethod -Uri "https://api.github.com/repos/sisong/HDiffPatch/releases/latest" - $downloadUrl = $response.assets | Where-Object { $_.name -like "*windows64*.zip" } | Select-Object -ExpandProperty browser_download_url - $zipFilePath = "hdiffpatch_windows64.zip" - $outputFolder = "hdiffpatch" + $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 - if (-Not (Test-Path -Path $outputFolder)) { - New-Item -ItemType Directory -Path $outputFolder - } - Expand-Archive -Path $zipFilePath -DestinationPath $outputFolder -Force - $exeFile = Get-ChildItem -Path $searchPath -Recurse -File -Filter "hdiffz.exe" | Select-Object -First 1 - Move-Item -Path $exeFile.FullName -Destination . -Force - Remove-Item -Path $outputFolder -Recurse -Force - Remove-Item -Path $zipFilePath - run: | Get-ChildItem -Filter *.zst | ForEach-Object { if ($_.PSIsContainer -eq $false) { @@ -118,8 +109,9 @@ jobs: Write-Host "$file -> $output_file" } } - 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] + 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: From 73ad4de7c0a0157a714128d2e2d3be89765f96fb Mon Sep 17 00:00:00 2001 From: xyToki <7547189+xytoki@users.noreply.github.com> Date: Thu, 16 Jan 2025 00:13:24 +0800 Subject: [PATCH 2/3] feat: build installer binary --- .github/workflows/publish.yml | 29 ++++++++++++++++++++++------- kachina.config.json | 15 +++++++++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 kachina.config.json diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4c39b61..c73714f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -94,13 +94,8 @@ jobs: with: name: scripts path: dist/BetterGI/Assets/Web/ScriptRepo - - name: download hdiffz + - name: Extract Map 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 - - run: | Get-ChildItem -Filter *.zst | ForEach-Object { if ($_.PSIsContainer -eq $false) { $file = $_.Name @@ -109,11 +104,31 @@ jobs: 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: | 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_* + 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 diff --git a/kachina.config.json b/kachina.config.json new file mode 100644 index 0000000..b52d456 --- /dev/null +++ b/kachina.config.json @@ -0,0 +1,15 @@ +{ + "dfsPath": "bgi", + "appName": "BetterGI", + "publisher": "babalae", + "regName": "BetterGI", + "exeName": "BetterGI.exe", + "uninstallName": "BetterGI.uninst.exe", + "updaterName": "BetterGI.update.exe", + "programFilesPath": "BetterGI", + "title": "BetterGI", + "description": "更好的原神,免费且开源", + "windowTitle": "BetterGI 安装程序", + "userDataPath": ["${INSTALL_PATH}/User"], + "extraUninstallPath": ["${INSTALL_PATH}/log"] +} From a63fcc9e4083e37208bd503206b111297f7136e1 Mon Sep 17 00:00:00 2001 From: xyToki <7547189+xytoki@users.noreply.github.com> Date: Thu, 16 Jan 2025 00:25:05 +0800 Subject: [PATCH 3/3] fix: fix 7z not upload --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c73714f..d57ef19 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -118,6 +118,7 @@ jobs: ..\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