mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-23 00:17:16 +08:00
116 lines
6.5 KiB
YAML
116 lines
6.5 KiB
YAML
name: Build Windows Installer (Reusable)
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
version:
|
|
description: 'Version string for the installer'
|
|
type: string
|
|
required: true
|
|
|
|
jobs:
|
|
Build_Windows_Installer:
|
|
runs-on: windows-latest
|
|
env:
|
|
VERSION: ${{ inputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Download Artifact Windows x64
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: v2raya_windows_x64_${{ inputs.version }}.exe
|
|
path: D:\Downloads
|
|
- name: Download TinyTun x64
|
|
shell: pwsh
|
|
run: |
|
|
$Url_TinyTun_x64 = "https://github.com/v2rayA/TinyTun/releases/download/v0.0.2-alpha.3/tinytun-v0.0.2-alpha.3-x86_64-pc-windows-msvc.zip"
|
|
$sha256_TinyTun_x64 = "a5e8c92999dc8d64862d14552ec833ea1ee2044cc8ac395eda03b041e1932ed4"
|
|
Invoke-WebRequest $Url_TinyTun_x64 -OutFile "D:\tinytun-x64.zip"
|
|
$hash_TinyTun_x64 = Get-FileHash -Path "D:\tinytun-x64.zip" -Algorithm SHA256
|
|
if ($hash_TinyTun_x64.Hash -ne $sha256_TinyTun_x64) {
|
|
throw "SHA256 hash mismatch for TinyTun x64. Expected: $sha256_TinyTun_x64, Actual: $($hash_TinyTun_x64.Hash)"
|
|
exit 1
|
|
} else {
|
|
Write-Host "SHA256 hash verified for TinyTun x64."
|
|
}
|
|
- name: Download Artifact Windows arm64
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: v2raya_windows_arm64_${{ inputs.version }}.exe
|
|
path: D:\Downloads
|
|
- name: Download TinyTun arm64
|
|
shell: pwsh
|
|
run: |
|
|
$Url_TinyTun_arm64 = "https://github.com/v2rayA/TinyTun/releases/download/v0.0.2-alpha.3/tinytun-v0.0.2-alpha.3-aarch64-pc-windows-msvc.zip"
|
|
$sha256_TinyTun_arm64 = "b39a39e319f12935580f62b7e93b83a013d45d9aa2ec7ce48433acf77fbafed9"
|
|
Invoke-WebRequest $Url_TinyTun_arm64 -OutFile "D:\tinytun-arm64.zip"
|
|
$hash_TinyTun_arm64 = Get-FileHash -Path "D:\tinytun-arm64.zip" -Algorithm SHA256
|
|
if ($hash_TinyTun_arm64.Hash -ne $sha256_TinyTun_arm64) {
|
|
throw "SHA256 hash mismatch for TinyTun arm64. Expected: $sha256_TinyTun_arm64, Actual: $($hash_TinyTun_arm64.Hash)"
|
|
exit 1
|
|
} else {
|
|
Write-Host "SHA256 hash verified for TinyTun arm64."
|
|
}
|
|
- name: Install Inno Setup
|
|
shell: pwsh
|
|
run: |
|
|
choco install innosetup -y
|
|
- name: Build Windows Installer
|
|
shell: pwsh
|
|
run: |
|
|
## Create Destination Directory
|
|
$CurrentDir = Get-Location
|
|
New-Item -ItemType Directory -Path "D:\v2raya-x64compatible-windows\data"
|
|
New-Item -ItemType Directory -Path "D:\v2raya-x64compatible-windows\bin"
|
|
New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\data"
|
|
New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\bin"
|
|
## Copy v2rayA to Destination Directory
|
|
Copy-Item -Path D:\Downloads\v2raya_windows_arm64_${{ inputs.version }}.exe -Destination D:\v2raya-arm64-windows\bin\v2raya.exe
|
|
Copy-Item -Path D:\Downloads\v2raya_windows_x64_${{ inputs.version }}.exe -Destination D:\v2raya-x64compatible-windows\bin\v2raya.exe
|
|
Copy-Item -Path ".\install\windows-inno\v2raya.ico" -Destination "D:\v2raya.ico"
|
|
## Copy TinyTun to Destination Directory
|
|
Expand-Archive -Path "D:\tinytun-x64.zip" -DestinationPath "D:\tinytun-x64"
|
|
Move-Item -Path "D:\tinytun-x64\tinytun-x86_64-pc-windows-msvc.exe" -Destination "D:\v2raya-x64compatible-windows\bin\tinytun.exe"
|
|
Move-Item -Path "D:\tinytun-x64\wintun.dll" -Destination "D:\v2raya-x64compatible-windows\bin\wintun.dll"
|
|
Expand-Archive -Path "D:\tinytun-arm64.zip" -DestinationPath "D:\tinytun-arm64"
|
|
Move-Item -Path "D:\tinytun-arm64\tinytun-aarch64-pc-windows-msvc.exe" -Destination "D:\v2raya-arm64-windows\bin\tinytun.exe"
|
|
Move-Item -Path "D:\tinytun-arm64\wintun.dll" -Destination "D:\v2raya-arm64-windows\bin\wintun.dll"
|
|
## Download and extract v2ray
|
|
$Url_v2ray_x64 = "https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-windows-64.zip"
|
|
$Url_v2ray_A64 = "https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-windows-arm64-v8a.zip"
|
|
Invoke-WebRequest $Url_v2ray_x64 -OutFile "D:\v2ray-windows-x64.zip"
|
|
Expand-Archive -Path "D:\v2ray-windows-x64.zip" -DestinationPath "D:\v2raya-x64compatible-windows\bin\"
|
|
Move-Item -Path "D:\v2raya-x64compatible-windows\bin\*.dat" -Destination "D:\v2raya-x64compatible-windows\data\"
|
|
Remove-Item -Path "D:\v2raya-x64compatible-windows\bin\*.json" -Force -Recurse -ErrorAction SilentlyContinue
|
|
Invoke-WebRequest $Url_v2ray_A64 -OutFile "D:\v2ray-windows-A64.zip"
|
|
Expand-Archive -Path "D:\v2ray-windows-A64.zip" -DestinationPath "D:\v2raya-arm64-windows\bin\"
|
|
Move-Item -Path "D:\v2raya-arm64-windows\bin\*.dat" -Destination "D:\v2raya-arm64-windows\data\"
|
|
Remove-Item -Path "D:\v2raya-arm64-windows\bin\*.json" -Force -Recurse -ErrorAction SilentlyContinue
|
|
Copy-Item -Path ".\LICENSE" -Destination "D:\LICENSE.txt"
|
|
Copy-Item -Path ".\install\windows-inno\ChineseSimplified.isl" -Destination "D:\ChineseSimplified.isl"
|
|
## Set Version
|
|
$((Get-Content -Path .\install\windows-inno\windows.iss).replace("TheRealVersion", "${{ inputs.version }}")).Replace("TheRealArch", "x64compatible") | Out-File "D:\windows_x86_64.iss"
|
|
$((Get-Content -Path .\install\windows-inno\windows.iss).replace("TheRealVersion", "${{ inputs.version }}")).Replace("TheRealArch", "arm64") | Out-File "D:\windows_arm64.iss"
|
|
## Build Installer
|
|
Set-Location -Path "D:\"
|
|
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' "D:\windows_x86_64.iss"
|
|
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' "D:\windows_arm64.iss"
|
|
## Rename to Friendly Name
|
|
cd $CurrentDir
|
|
Copy-Item -Path D:\installer_windows_inno_x64compatible.exe -Destination $CurrentDir\installer_windows_inno_x64_${{ inputs.version }}.exe
|
|
Copy-Item -Path D:\installer_windows_inno_arm64.exe -Destination $CurrentDir\installer_windows_inno_arm64_${{ inputs.version }}.exe
|
|
- name: Upload x64 Build
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: installer_windows_inno_x64_${{ inputs.version }}.exe
|
|
path: |
|
|
installer_windows_inno_x64_${{ inputs.version }}.exe
|
|
- name: Upload arm64 Build
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: installer_windows_inno_arm64_${{ inputs.version }}.exe
|
|
path: |
|
|
installer_windows_inno_arm64_${{ inputs.version }}.exe
|