Browse Source

Merge pull request #2895 from database64128/v5/master

📦 More artifacts: Package into a self-contained single-file executable for better portability.
pull/2937/head
Allen Zhu GitHub 5 years ago
parent
commit
444f1ba9f8
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 22 deletions
  1. +24
    -22
      appveyor.yml

+ 24
- 22
appveyor.yml View File

@@ -103,7 +103,7 @@ before_build:
# scripts to run after build (working directory and environment changes are persisted from the previous steps)
after_build:
- ps: |+
function CalculateHash($file)
function Calculate-Hash($file)
{
$newLine = "`r`n"
$text = (Split-Path $file -Leaf) + $newLine
@@ -119,35 +119,37 @@ after_build:
}
$WorkingFolder = "$env:APPVEYOR_BUILD_FOLDER\working"
$ExeFileName = "Shadowsocks-$env:APPVEYOR_BUILD_VERSION-$env:CONFIGURATION.exe"
$DllFileName = "Shadowsocks.dll"
$ExeFile = "$WorkingFolder\$DNVer\$ExeFileName"
$DllFile = "$WorkingFolder\$DNVer\$DllFileName"
New-Item $WorkingFolder -ItemType Directory -Force
Copy-Item $env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:CONFIGURATION\netcoreapp3.1\Shadowsocks.exe $WorkingFolder\Shadowsocks.exe
Copy-Item $env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:CONFIGURATION\netcoreapp3.1\Shadowsocks.dll $WorkingFolder\Shadowsocks.dll
Copy-Item $env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:CONFIGURATION\netcoreapp3.1\Shadowsocks.runtimeconfig.json $WorkingFolder\Shadowsocks.runtimeconfig.json
Copy-Item $WorkingFolder\Shadowsocks.exe $ExeFile
# Copy-Item $WorkingFolder\Shadowsocks.dll $DllFile
# Create and deploy the release zip
$ReleaseFile = "$WorkingFolder\Shadowsocks.exe"
$ReleaseFile2 = "$WorkingFolder\Shadowsocks.dll"
$ReleaseFile3 = "$WorkingFolder\Shadowsocks.runtimeconfig.json"
$ZipFile = "$WorkingFolder\Shadowsocks-$env:APPVEYOR_BUILD_VERSION.zip"
$ReleaseFile = "$env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:CONFIGURATION\netcoreapp3.1\Shadowsocks.exe"
$ReleaseFile2 = "$env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:CONFIGURATION\netcoreapp3.1\Shadowsocks.dll"
$ReleaseFile3 = "$env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:CONFIGURATION\netcoreapp3.1\Shadowsocks.runtimeconfig.json"
$ZipFile = "$WorkingFolder\Shadowsocks-$env:APPVEYOR_BUILD_VERSION-minimal.zip"
$ZipHashFile = "$ZipFile.hash"
# Calculate exe Hash and archieve both exe and hash to zip
CalculateHash -file $ReleaseFile | Out-File -FilePath $hashFile
7z a $ZipFile $ReleaseFile
7z a $ZipFile $ReleaseFile2
7z a $ZipFile $ReleaseFile3
Push-AppveyorArtifact $ZipFile
# Calculate zip Hash
CalculateHash -file $ZipFile | Out-File -FilePath $ZipHashFile
Calculate-Hash -file $ZipFile | Out-File -FilePath $ZipHashFile -Append
# Package into a self-contained single-file executable
dotnet publish -f netcoreapp3.1 -r win-x64 -c $env:CONFIGURATION -p:PublishSingleFile=true -p:PublishTrimmed=true $env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\shadowsocks-csharp.csproj
dotnet publish -f netcoreapp3.1 -r win-x86 -c $env:CONFIGURATION -p:PublishSingleFile=true -p:PublishTrimmed=true $env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\shadowsocks-csharp.csproj
$SingleExeX64 = "$env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\Any CPU\$env:CONFIGURATION\netcoreapp3.1\win-x64\publish\Shadowsocks.exe"
$SingleExeX86 = "$env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\Any CPU\$env:CONFIGURATION\netcoreapp3.1\win-x86\publish\Shadowsocks.exe"
$ZipSingleExeX64 = "$WorkingFolder\Shadowsocks-$env:APPVEYOR_BUILD_VERSION-portable-x64.zip"
$ZipSingleExeX86 = "$WorkingFolder\Shadowsocks-$env:APPVEYOR_BUILD_VERSION-portable-x86.zip"
$HashZipX64 = "$ZipSingleExeX64.hash"
$HashZipX86 = "$ZipSingleExeX86.hash"
7z a $ZipSingleExeX64 $SingleExeX64
7z a $ZipSingleExeX86 $SingleExeX86
Calculate-Hash -file $ZipSingleExeX64 | Out-File -FilePath $ZipHashFile -Append
Calculate-Hash -file $ZipSingleExeX86 | Out-File -FilePath $ZipHashFile -Append
Push-AppveyorArtifact $ZipSingleExeX64
Push-AppveyorArtifact $ZipSingleExeX86
Push-AppveyorArtifact $ZipHashFile
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
# before_package:


Loading…
Cancel
Save