From 407ed5e9b3fee07f18ac1c577c767592109a4f9d Mon Sep 17 00:00:00 2001 From: Adam Gauthier Date: Tue, 14 Dec 2021 23:10:17 -0800 Subject: [PATCH] Pack metapackage with Discord.Net.Core version To avoid any mismatch between both versions and duplication in the code, the .nuspec file is simplified. The build process now ensures the version is set to the exact version Discord.Net.Core is packed with. --- azure/deploy.yml | 16 ++++---- src/Discord.Net/Discord.Net.nuspec | 64 +++++++++++++++--------------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/azure/deploy.yml b/azure/deploy.yml index 4742da3c8..8e553a7cf 100644 --- a/azure/deploy.yml +++ b/azure/deploy.yml @@ -10,22 +10,20 @@ steps: dotnet pack "src\Discord.Net.Interactions\Discord.Net.Interactions.csproj" --no-restore --no-build -v minimal -c $(buildConfiguration) -o "$(Build.ArtifactStagingDirectory)" /p:BuildNumber=$(buildNumber) /p:IsTagBuild=$(buildTag) displayName: Pack projects -- task: NuGetCommand@2 - displayName: Pack metapackage (release mode) - condition: eq(variables['buildTag'], True) - inputs: - command: 'pack' - packagesToPack: 'src/Discord.Net/Discord.Net.nuspec' - versioningScheme: 'off' +- pwsh: | + $package = Get-ChildItem $(Build.ArtifactStagingDirectory)/Discord.Net.Core*.nupkg + $version = $package.Name.Replace("Discord.Net.Core.", "").Replace(".nupkg", "") + + Write-Output "##vso[task.setvariable variable=packedVersion;]$version" + displayName: Retrieve packed version - task: NuGetCommand@2 displayName: Pack metapackage - condition: eq(variables['buildTag'], False) inputs: command: 'pack' packagesToPack: 'src/Discord.Net/Discord.Net.nuspec' versioningScheme: 'off' - buildProperties: 'suffix=-$(buildNumber)' + buildProperties: 'version=$(packedVersion)' - task: NuGetCommand@2 displayName: Push to NuGet diff --git a/src/Discord.Net/Discord.Net.nuspec b/src/Discord.Net/Discord.Net.nuspec index b208ca6be..ba70fb1c4 100644 --- a/src/Discord.Net/Discord.Net.nuspec +++ b/src/Discord.Net/Discord.Net.nuspec @@ -2,7 +2,7 @@ Discord.Net - 3.1.0$suffix$ + $version$ Discord.Net Discord.Net Contributors foxbot @@ -14,45 +14,45 @@ https://github.com/RogueException/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - \ No newline at end of file +