-
Notifications
You must be signed in to change notification settings - Fork 694
/
appveyor.yml
86 lines (66 loc) · 3.83 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
image: Visual Studio 2022
configuration: Release
platform: x64
install:
- git submodule update --init
before_build:
- dotnet restore %APPVEYOR_BUILD_FOLDER%\Source\NETworkManager.sln
- ps: |
# Set the version based on the current date (e.g. 2024.4.27.0)
$Date = Get-Date
$VersionString = $Date.ToString("yyyy.M.d.0")
Write-Host "Set NETworkManager version set to $VersionString"
# Update assembly version
$AssemblyVersionPattern = '\[assembly: AssemblyVersion\("(.*)"\)\]'
$AssemblyFileVersionPattern = '\[assembly: AssemblyFileVersion\("(.*)"\)\]'
$AssemblyFile = "$($env:APPVEYOR_BUILD_FOLDER)\Source\GlobalAssemblyInfo.cs"
$AssemlbyContent = Get-Content -Path $AssemblyFile -Encoding utf8
$AssemlbyContent = $AssemlbyContent -replace $AssemblyVersionPattern, "[assembly: AssemblyVersion(""$($VersionString)"")]"
$AssemlbyContent = $AssemlbyContent -replace $AssemblyFileVersionPattern, "[assembly: AssemblyFileVersion(""$($VersionString)"")]"
$AssemlbyContent | Set-Content -Path $AssemblyFile -Encoding utf8
# Set setup version information
$SetupVersionString = $Date.ToString("yy.M.d") # MSI only supports major.minor.build and 255 as highest value
Write-Host "Set NETworkManager setup version set to $SetupVersionString"
$SetupVersionPattern = '<\?define ProductVersion="(.*)" \?>'
$SetupFile = ".\Source\NETworkManager.Setup\Package.wxs"
$SetupContent = Get-Content -Path "$SetupFile" -Encoding utf8
$SetupContent = $SetupContent -replace $SetupVersionPattern, "<?define ProductVersion=""$SetupVersionString"" ?>"
$SetupContent | Set-Content -Path "$SetupFile" -Encoding utf8
build_script:
- dotnet build %APPVEYOR_BUILD_FOLDER%\Source\NETworkManager.sln --configuration Release --no-restore
after_build:
- ps: |
if($env:APPVEYOR_REPO_TAG -eq $false) {
Write-Host "Release build is skipped because no tag was found!"
return
}
# Build path
$BuildPath = "$($env:APPVEYOR_BUILD_FOLDER)\Source\NETworkManager\bin\Release\net8.0-windows10.0.22621.0\win-x64"
$SetupPath = "$($env:APPVEYOR_BUILD_FOLDER)\Source\NETworkManager.Setup\bin\x64\Release\en-US\NETworkManager.Setup.msi"
$ArtifactsPath = "$($env:APPVEYOR_BUILD_FOLDER)\Artifacts"
# Get version
$Version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$($BuildPath)\NETworkManager.exe").FileVersion
# Cleanup build
Get-ChildItem -Path "$BuildPath" -Recurse | Where-Object { $_.Name.EndsWith(".pdb") } | Remove-Item
Remove-Item -Path "$($BuildPath)\WebView2Loader.dll"
# Create release folder
New-Item -Path "$ArtifactsPath" -ItemType Directory -Force | Out-Null
# Create archive
Compress-Archive -Path "$($BuildPath)\*" -DestinationPath "$($ArtifactsPath)\NETworkManager_$($Version)_Archive.zip"
# Create portable
New-Item -Path "$BuildPath" -Name "IsPortable.settings" -ItemType File | Out-Null
Compress-Archive -Path "$($BuildPath)\*" -DestinationPath "$($ArtifactsPath)\NETworkManager_$($Version)_Portable.zip"
Remove-Item -Path "$($BuildPath)\IsPortable.settings"
# Copy setup
Move-Item -Path "$SetupPath" -Destination "$($ArtifactsPath)\NETworkManager_$($Version)_Setup.msi"
# Create artifacts archive for signing
Compress-Archive -Path "$ArtifactsPath\*" -DestinationPath "$($ArtifactsPath).zip"
artifacts:
- path: 'Artifacts.zip'
deploy:
- provider: Webhook
url: https://app.signpath.io/API/v1/0a191750-608c-457a-a11d-8a5433ad6491/Integrations/AppVeyor?ProjectSlug=NETworkManager&SigningPolicySlug=release-signing&ArtifactConfigurationSlug=artifacts
authorization:
secure: PF6YBkp3Gg4c9TUX4HOzgjG5FeCzq9hYMCG5Zbs6xEL3jVuWe605D+Q/x1PKtK/q2nxUGzQIvOdiWbXMnUXWQg==
on:
APPVEYOR_REPO_TAG: true