From 44e2d7e6563cf48b2728ac85043de96ff4fb59cc Mon Sep 17 00:00:00 2001 From: database64128 Date: Mon, 14 Sep 2020 01:23:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=97=20Use=20`dotnet=20publish`=20for?= =?UTF-8?q?=20artifacts=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Cleanup of build script - Cleanup of publish profiles --- appveyor.yml | 37 ++++++++----------- .../PublishProfiles/FolderProfile.pubxml | 11 ++---- .../PublishProfiles/FolderProfile.pubxml.user | 6 +-- 3 files changed, 21 insertions(+), 33 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bc8cb60d..799ff7e6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -120,36 +120,29 @@ after_build: $WorkingFolder = "$env:APPVEYOR_BUILD_FOLDER\working" New-Item $WorkingFolder -ItemType Directory -Force + $HashFile = "all.hash" - # Create and deploy the release 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" - 7z a $ZipFile $ReleaseFile - 7z a $ZipFile $ReleaseFile2 - 7z a $ZipFile $ReleaseFile3 - Push-AppveyorArtifact $ZipFile - Calculate-Hash -file $ZipFile | Out-File -FilePath $ZipHashFile -Append + # Publish and deploy + # Normal package + dotnet publish -f netcoreapp3.1 -c $env:CONFIGURATION $env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\shadowsocks-csharp.csproj # 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 + $ZipMinimal = "$WorkingFolder\shadowsocks-windows-$env:APPVEYOR_BUILD_VERSION-minimal.zip" + $ZipSingleExeX64 = "$WorkingFolder\shadowsocks-windows-$env:APPVEYOR_BUILD_VERSION-portable-x64.zip" + $ZipSingleExeX86 = "$WorkingFolder\shadowsocks-windows-$env:APPVEYOR_BUILD_VERSION-portable-x86.zip" + 7z a $ZipMinimal "$env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\Any CPU\$env:CONFIGURATION\netcoreapp3.1\publish\*" + 7z a $ZipSingleExeX64 "$env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\Any CPU\$env:CONFIGURATION\netcoreapp3.1\win-x64\publish\Shadowsocks.exe" + 7z a $ZipSingleExeX86 "$env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\Any CPU\$env:CONFIGURATION\netcoreapp3.1\win-x86\publish\Shadowsocks.exe" + Calculate-Hash -file $ZipMinimal | Out-File -FilePath $HashFile -Append + Calculate-Hash -file $ZipSingleExeX64 | Out-File -FilePath $HashFile -Append + Calculate-Hash -file $ZipSingleExeX86 | Out-File -FilePath $HashFile -Append + Push-AppveyorArtifact $ZipMinimal Push-AppveyorArtifact $ZipSingleExeX64 Push-AppveyorArtifact $ZipSingleExeX86 - Push-AppveyorArtifact $ZipHashFile + Push-AppveyorArtifact $HashFile # scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services) # before_package: diff --git a/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml b/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml index 411239eb..94842414 100644 --- a/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml +++ b/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml @@ -1,17 +1,12 @@  - - FileSystem Release Any CPU - netcoreapp3.1 bin\Release\netcoreapp3.1\publish\ - win-x86 - false - True - False + FileSystem \ No newline at end of file diff --git a/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml.user b/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml.user index 1a189e4f..ede65b29 100644 --- a/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -1,6 +1,6 @@  - - \ No newline at end of file +