diff --git a/.github/workflows/windows_inno.yml b/.github/workflows/windows_inno.yml new file mode 100644 index 00000000..8083e98e --- /dev/null +++ b/.github/workflows/windows_inno.yml @@ -0,0 +1,51 @@ +name: Release v2rayA inno installer + +on: + push: + branches: [ feat_v5 ] + +jobs: + build: + runs-on: "windows-latest" + steps: + - uses: actions/checkout@v3 + - name: Add PowerShell + uses: Amadevus/pwsh-script@v2.0.1 + - name: Install Inno Setup + run: | + choco install innosetup -y + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ^1.17 + - name: Set up Node.js + uses: actions/setup-node@v2.4.0 + with: + node-version: lts/* + cache: 'yarn' + cache-dependency-path: gui/yarn.lock + - name: build v2rayA installer + shell: pwsh + run: | + pwsh -c ./install/windows-inno/build-helper.ps1 + - name: Rename to friendly name + shell: bash + run: | + mv installer_windows_inno_x64.exe installer_windows_inno_x64_${{ steps.prep.outputs.VERSION }}.exe + mv installer_windows_inno_arm64.exe installer_windows_inno_arm64_${{ steps.prep.outputs.VERSION }}.exe + - name: Upload Artifact + if: "!startsWith(github.ref, 'refs/tags/v')" + uses: nanoufo/action-upload-artifacts-and-release-assets@v1.4 + with: + path: | + installer_windows_inno_x64_${{ steps.prep.outputs.VERSION }}.exe + installer_windows_inno_arm64_${{ steps.prep.outputs.VERSION }}.exe + - name: Github Release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v1 + with: + draft: true + prerelease: true + files: | + installer_windows_inno_x64_${{ steps.prep.outputs.VERSION }}.exe + installer_windows_inno_arm64_${{ steps.prep.outputs.VERSION }}.exe \ No newline at end of file diff --git a/install/windows-inno/build-helper.ps1 b/install/windows-inno/build-helper.ps1 new file mode 100644 index 00000000..784b0266 --- /dev/null +++ b/install/windows-inno/build-helper.ps1 @@ -0,0 +1,119 @@ +Function Compress-File([ValidateScript({Test-Path $_})][string]$File){ + + $srcFile = Get-Item -Path $File + $newFileName = "$($srcFile.FullName).gz" + + try + { + $srcFileStream = New-Object System.IO.FileStream($srcFile.FullName,([IO.FileMode]::Open),([IO.FileAccess]::Read),([IO.FileShare]::Read)) + $dstFileStream = New-Object System.IO.FileStream($newFileName,([IO.FileMode]::Create),([IO.FileAccess]::Write),([IO.FileShare]::None)) + $gzip = New-Object System.IO.Compression.GZipStream($dstFileStream,[System.IO.Compression.CompressionMode]::Compress) + $srcFileStream.CopyTo($gzip) + } + catch + { + Write-Host "$_.Exception.Message" -ForegroundColor Red + } + finally + { + $gzip.Dispose() + $srcFileStream.Dispose() + $dstFileStream.Dispose() + } +} + +yarn --cwd gui --check-files +yarn --cwd gui build + +Get-ChildItem "./web" -recurse |Where-Object{$_.PSIsContainer -eq $False}|ForEach-Object -Process{ + if($_.Extension -ne ".png" -and $_.Extension -ne ".gz" -and $_.Name -ne "index.html"){ + Compress-File($_.FullName) + Remove-Item -Path $_.FullName + } +} + +Copy-Item -Path ./web ./service/server/router/ -Recurse + +New-Item -ItemType Directory -Path ./ -Name "v2raya-x86_64-windows"; New-Item -ItemType Directory -Path ".\v2raya-x86_64-windows\bin" +New-Item -ItemType Directory -Path ./ -Name "v2raya-arm64-windows"; New-Item -ItemType Directory -Path ".\v2raya-arm64-windows\bin" + +Set-Location -Path ./service +$env:CGO_ENABLED = "0" +$build_flags = '-X github.com/v2rayA/v2rayA/conf.Version=' + $VERSION +$env:GOARCH = "amd64"; $env:GOOS = "windows"; go build -ldflags $build_flags -o '../v2raya-x86_64-windows/bin/v2raya.exe' +$env:GOARCH = "arm64"; $env:GOOS = "windows"; go build -ldflags $build_flags -o '../v2raya-arm64-windows/bin/v2raya.exe' + +Set-Location ../ + +Copy-Item "./v2raya-x86_64-windows/" "D:\" -Recurse +New-Item -ItemType Directory -Path "D:\v2raya-x86_64-windows\data" +New-Item -ItemType Directory -Path "D:\v2raya-x86_64-windows\config" + +Copy-Item "./v2raya-arm64-windows/" "D:\" -Recurse +New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\data" +New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\config" + +$NoticeInfo = "This folder contains the datas of v2rayA, remove the db file if you forget password." +Set-Content -Path "D:\v2raya-x86_64-windows\config\help.txt" $NoticeInfo +Set-Content -Path "D:\v2raya-arm64-windows\config\help.txt" $NoticeInfo + +$Version_v2ray = Invoke-WebRequest -Uri 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest' | ConvertFrom-Json | Select-Object tag_name | ForEach-Object { ([string]$_.tag_name).Split('v')[1] } +$Url_v2ray_x64 = "https://github.com/v2fly/v2ray-core/releases/download/v$Version_v2ray/v2ray-windows-64.zip" +$Url_v2ray_A64 = "https://github.com/v2fly/v2ray-core/releases/download/v$Version_v2ray/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-x86_64-windows\bin\" +Move-Item -Path "D:\v2raya-x86_64-windows\bin\*.dat" -Destination "D:\v2raya-x86_64-windows\data" +Remove-Item -Path "D:\v2raya-x86_64-windows\bin\wv2ray.exe" -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-arm-windows\bin\wv2ray.exe" -Force -Recurse -ErrorAction SilentlyContinue + +$Url_WinSW = "https://github.com/winsw/winsw/releases/download/v3.0.0-alpha.10/WinSW-net461.exe" +Invoke-WebRequest $Url_WinSW -OutFile "D:\WinSW.exe" +Copy-Item -Path "D:\WinSW.exe" -Destination "D:\v2raya-x86_64-windows\v2rayA-service.exe" +Copy-Item -Path "D:\WinSW.exe" -Destination "D:\v2raya-arm64-windows\v2rayA-service.exe" + +Set-Content -Value ' + + +v2rayA +v2rayA background service for Windows +v2rayA is a V2Ray client, compatible with SS, SSR, Trojan(trojan-go), PingTunnel protocols. +%BASE%\bin\v2raya.exe +--lite --log-file "v2raya.log" --v2ray-bin "%BASE%\bin\v2ray.exe" --v2ray-assetsdir "%BASE%\data" --config "%BASE%\config" +%TEMP% + +true + + +' -Path "D:\v2raya-x86_64-windows\v2rayA-service.xml" +Copy-Item -Path "D:\v2raya-x86_64-windows\v2rayA-service.xml" -Destination "D:\v2raya-arm64-windows\v2rayA-service.xml" + +Invoke-WebRequest -Uri "https://raw.githubusercontent.com/v2rayA/v2rayA/feat_v5/LICENSE" -OutFile "D:\LICENSE.txt" + +& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' "./install/windows-inno/windows_x86_64.iss" +& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' "./install/windows-inno/windows_arm64.iss" + +Copy-Item D:\install*.exe .\ \ No newline at end of file diff --git a/install/windows-inno/windows_arm64.iss b/install/windows-inno/windows_arm64.iss new file mode 100644 index 00000000..46580618 --- /dev/null +++ b/install/windows-inno/windows_arm64.iss @@ -0,0 +1,67 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppName "v2rayA" +#define MyAppVersion "1.5.9.1698.1" +#define MyAppPublisher "v2rayA Organization" +#define MyAppURL "https://v2raya.org/" +#define MyAppExeName "v2rayA-service.exe" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{B991C73A-599E-460D-A35A-D1ED414DADBF} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +ArchitecturesInstallIn64BitMode=arm64 +DefaultDirName={autopf}\{#MyAppName} +; DisableDirPage=yes +DefaultGroupName={#MyAppName} +DisableProgramGroupPage=yes +LicenseFile=D:\LICENSE.txt +; Uncomment the following line to run in non administrative install mode (install for current user only.) +;PrivilegesRequired=lowest +OutputDir=D:\ +OutputBaseFilename=installer_windows_inno_arm64.exe +Compression=lzma +SolidCompression=yes +WizardStyle=modern + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Files] +Source: "D:\v2raya-arm64-windows\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\v2raya-arm64-windows\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "D:\v2raya-arm64-windows\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "D:\v2raya-arm64-windows\config\*"; DestDir: "{app}\config"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "D:\v2raya-arm64-windows\v2rayA-service.xml"; DestDir: "{app}"; Flags: ignoreversion +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{group}\v2rayA Web Panel"; Filename: "http://localhost:2017" +Name: "{group}\v2rayA Wiki"; Filename: "{#MyAppURL}" +Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" + +[Run] +Filename: "{app}\{#MyAppExeName}"; Parameters: "install"; +Filename: "{app}\{#MyAppExeName}"; Parameters: "start"; + +[UninstallRun] +Filename: "{app}\{#MyAppExeName}"; Parameters: "stop"; +Filename: "{app}\{#MyAppExeName}"; Parameters: "uninstall"; + +[UninstallDelete] +Type: files; Name: "{app}\v2rayA-service.wrapper.log" +Type: files; Name: "{app}\v2rayA-service.out.log" +Type: files; Name: "{app}\v2rayA-service.wrapper.log" +Type: files; Name: "{app}\v2rayA-service.wrapper.log.old" +Type: files; Name: "{app}\v2rayA-service.out.log.old" +Type: files; Name: "{app}\v2rayA-service.wrapper.log.old" +Type: files; Name: "{app}\v2rayA-service.err.log" +Type: files; Name: "{app}\v2rayA-service.err.log.old" \ No newline at end of file diff --git a/install/windows-inno/windows_x86_64.iss b/install/windows-inno/windows_x86_64.iss new file mode 100644 index 00000000..b2373838 --- /dev/null +++ b/install/windows-inno/windows_x86_64.iss @@ -0,0 +1,67 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppName "v2rayA" +#define MyAppVersion "1.5.9.1698.1" +#define MyAppPublisher "v2rayA Organization" +#define MyAppURL "https://v2raya.org/" +#define MyAppExeName "v2rayA-service.exe" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{B991C73A-599E-460D-A35A-D1ED414DADBF} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +ArchitecturesInstallIn64BitMode=x64 +DefaultDirName={autopf}\{#MyAppName} +; DisableDirPage=yes +DefaultGroupName={#MyAppName} +DisableProgramGroupPage=yes +LicenseFile=D:\LICENSE.txt +; Uncomment the following line to run in non administrative install mode (install for current user only.) +;PrivilegesRequired=lowest +OutputDir=D:\ +OutputBaseFilename=installer_windows_inno_x64.exe +Compression=lzma +SolidCompression=yes +WizardStyle=modern + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Files] +Source: "D:\v2raya-x86_64-windows\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\v2raya-x86_64-windows\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "D:\v2raya-x86_64-windows\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "D:\v2raya-x86_64-windows\config\*"; DestDir: "{app}\config"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "D:\v2raya-x86_64-windows\v2rayA-service.xml"; DestDir: "{app}"; Flags: ignoreversion +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{group}\v2rayA Web Panel"; Filename: "http://localhost:2017" +Name: "{group}\v2rayA Wiki"; Filename: "{#MyAppURL}" +Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" + +[Run] +Filename: "{app}\{#MyAppExeName}"; Parameters: "install"; +Filename: "{app}\{#MyAppExeName}"; Parameters: "start"; + +[UninstallRun] +Filename: "{app}\{#MyAppExeName}"; Parameters: "stop"; +Filename: "{app}\{#MyAppExeName}"; Parameters: "uninstall"; + +[UninstallDelete] +Type: files; Name: "{app}\v2rayA-service.wrapper.log" +Type: files; Name: "{app}\v2rayA-service.out.log" +Type: files; Name: "{app}\v2rayA-service.wrapper.log" +Type: files; Name: "{app}\v2rayA-service.wrapper.log.old" +Type: files; Name: "{app}\v2rayA-service.out.log.old" +Type: files; Name: "{app}\v2rayA-service.wrapper.log.old" +Type: files; Name: "{app}\v2rayA-service.err.log" +Type: files; Name: "{app}\v2rayA-service.err.log.old" \ No newline at end of file