From 255e7bb08ef517442264d09e8fdb6673fc99bb54 Mon Sep 17 00:00:00 2001 From: xyToki <7547189+xytoki@users.noreply.github.com> Date: Sat, 21 Jun 2025 21:48:51 +0800 Subject: [PATCH] ci: embed dotnet to mirrorc exe --- .github/workflows/publish.yml | 58 ++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7dd96213..c908417f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -371,41 +371,83 @@ jobs: mirrorchyan_uploading: if: github.repository_owner == 'babalae' && contains(needs.validate.outputs.version, '-') needs: [validate, build_dist, build_installer] - runs-on: macos-latest + runs-on: windows-latest steps: - uses: actions/download-artifact@v4 with: path: downloads github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: 📥 Download kachina-builder release + if: ${{ github.event.inputs.kachina-channel == 'release' }} + uses: robinraju/release-downloader@v1.8 + with: + repository: "YuehaiTeam/kachina-installer" + latest: true + fileName: "kachina-builder.exe" + - name: 📥 Download kachina-builder dev + if: ${{ github.event.inputs.kachina-channel == 'dev' }} + uses: dawidd6/action-download-artifact@v8 + with: + github_token: ${{secrets.GITHUB_TOKEN}} + repo: "YuehaiTeam/kachina-installer" + workflow: "build.yml" + name: artifact + branch: main + event: push + workflow_conclusion: success - - name: Extract 7z + - name: Embed Dotnet and VCRedist + shell: bash + run: | + # dotnet + VERSION_URL="https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/8.0/latest.version" + VERSION=$(curl -fsSL "$VERSION_URL" | tr -d '\r\n') + if [ -z "$VERSION" ]; then + echo "Cannot get the latest version from $VERSION_URL" + exit 1 + fi + INSTALLER_URL="https://builds.dotnet.microsoft.com/dotnet/WindowsDesktop/${VERSION}/windowsdesktop-runtime-${VERSION}-win-x64.exe" + OUTPUT="windowsdesktop-runtime-${VERSION}-win-x64.exe" + echo "Downloading Windows Desktop Runtime version $VERSION from $INSTALLER_URL" + curl -fSL -o "$OUTPUT" "$INSTALLER_URL" + # vcredist + echo "Downloading VCRedist" + curl -fSL -o "vc_redist.x64.exe" "https://aka.ms/vs/17/release/vc_redist.x64.exe" + # embed + echo "Embedding runtimes" + ./kachina-builder.exe append -o ./downloads/BetterGI_Install/BetterGI.Install.*.exe -f "$OUTPUT" -n "Microsoft.DotNet.DesktopRuntime.8" -f "vc_redist.x64.exe" -n "Microsoft.VCRedist.2015+.x64" + + - name: Extract 7z and create zip shell: bash run: | cd downloads/BetterGI_7z 7z x BetterGI_v*.7z -oun7z mv ../BetterGI_Metadata/metadata.json ./un7z/BetterGI/.metadata.json + 7z a -tzip BetterGI.zip un7z/BetterGI -mx=5 -mf=BCJ2 -r -y + ls . + ls ./un7z/BetterGI + choco install wget --no-progress - name: Upload Zip uses: MirrorChyan/uploading-action@v1 with: filetype: local mirrorchyan_rid: BGI - working-directory: downloads/BetterGI_7z/un7z/ - pick_files: '["BetterGI"]' + filename: "downloads/BetterGI_7z/BetterGI.zip" version_name: ${{ needs.validate.outputs.version }} upload_token: ${{ secrets.MirrorChyanUploadToken }} os: win arch: x64 - + - name: Upload Install.exe + if: always() uses: MirrorChyan/uploading-action@v1 with: filetype: local mirrorchyan_rid: BGI - working-directory: downloads/BetterGI_Install/ - filename: "BetterGI.Install.*.exe" - extra_zip: true + filename: "downloads/BetterGI_Install/BetterGI.Install.*.exe" version_name: ${{ needs.validate.outputs.version }} upload_token: ${{ secrets.MirrorChyanUploadToken }}