代码拉取完成,页面将自动刷新
image: Visual Studio 2022
#branches:
# only:
# - main
configuration: Release
platform: x64
install:
- git submodule update --init
before_build:
- dotnet restore %APPVEYOR_BUILD_FOLDER%\Source\NETworkManager.sln
- ps: |
# Update the version based on the current date (e.g. 2024.4.27.0)
$Date = Get-Date
$VersionString = "$($Date.Year).$($Date.Month).$($Date.Day).0"
Write-Host "Set NETworkManager version set to $VersionString"
# Update assembly version
$PatternVersion = '\[assembly: AssemblyVersion\("(.*)"\)\]'
$PatternFileVersion = '\[assembly: AssemblyFileVersion\("(.*)"\)\]'
$AssemblyFile = "$($env:APPVEYOR_BUILD_FOLDER)\Source\GlobalAssemblyInfo.cs"
$AssemlbyContent = Get-Content -Path $AssemblyFile -Encoding utf8
$AssemlbyContent = $AssemlbyContent -replace $PatternVersion, "[assembly: AssemblyVersion(""$($VersionString)"")]"
$AssemlbyContent = $AssemlbyContent -replace $PatternFileVersion, "[assembly: AssemblyFileVersion(""$($VersionString)"")]"
$AssemlbyContent | Set-Content -Path $AssemblyFile -Encoding utf8
# Update inno setup version
$PatternSetupVersion = '#define MyAppVersion "(.*)"'
$InnoSetupFile = ".\InnoSetup.iss"
$SetupContent = Get-Content -Path "$InnoSetupFile" -Encoding utf8
$SetupContent = $SetupContent -replace $PatternSetupVersion, "#define MyAppVersion ""$($VersionString)"""
$SetupContent | Set-Content -Path "$InnoSetupFile" -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
}
# Copy build
New-Item -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager" -ItemType Directory -Force | Out-Null
Copy-Item -Path "$($env:APPVEYOR_BUILD_FOLDER)\Source\NETworkManager\bin\Release\net8.0-windows10.0.17763.0\win-x64\*" -Destination "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager" -Recurse -Force
# Cleanup build
Get-ChildItem -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager" | Where-Object { $_.Name.EndsWith(".pdb") } | Remove-Item
Remove-Item -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager\WebView2Loader.dll"
# Version
$Version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager\NETworkManager.exe").FileVersion
# Create archive
##Compress-Archive -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager" -DestinationPath "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager_$($Version)_Archive.zip"
# Create portable
##New-Item -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager" -Name "IsPortable.settings" -ItemType File | Out-Null
##Compress-Archive -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager" -DestinationPath "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager_$($Version)_Portable.zip"
##Remove-Item -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager\IsPortable.settings"
# Create setup
$InnoSetupPath = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe"
Start-Process -FilePath $InnoSetupPath -ArgumentList """$($env:APPVEYOR_BUILD_FOLDER)\InnoSetup.iss""" -NoNewWindow -Wait
# Create SHA256 file hashes
##foreach ($hash in Get-ChildItem -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build" | Where-Object { $_.Name.EndsWith(".zip") -or $_.Name.EndsWith(".exe") } | Get-FileHash) {
## "$($hash.Algorithm) | $($hash.Hash) | $([System.IO.Path]::GetFileName($hash.Path))" | Out-File -FilePath "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager_$($Version)_Hash.txt" -Encoding utf8 -Append
##}
##Get-Content -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager_$($Version)_Hash.txt"
Remove-Item -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build\NETworkManager" -Recurse
Compress-Archive -Path "$($env:APPVEYOR_BUILD_FOLDER)\Build" -DestinationPath "$($env:APPVEYOR_BUILD_FOLDER)\releases_unsigned.zip"
artifacts:
- path: 'releases_unsigned.zip'
deploy:
- provider: Webhook
url: https://app.signpath.io/API/v1/0a191750-608c-457a-a11d-8a5433ad6491/Integrations/AppVeyor?ProjectSlug=NETworkManager&SigningPolicySlug=test-signing&ArtifactConfigurationSlug=initial
authorization:
secure: PF6YBkp3Gg4c9TUX4HOzgjG5FeCzq9hYMCG5Zbs6xEL3jVuWe605D+Q/x1PKtK/q2nxUGzQIvOdiWbXMnUXWQg==
on:
APPVEYOR_REPO_TAG: true
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。