Skip to content

Commit

Permalink
Pack metapackage with Discord.Net.Core version
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
adamgauthier committed Jan 14, 2022
1 parent a06ba9f commit 407ed5e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 41 deletions.
16 changes: 7 additions & 9 deletions azure/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 32 additions & 32 deletions src/Discord.Net/Discord.Net.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Discord.Net</id>
<version>3.1.0$suffix$</version>
<version>$version$</version>
<title>Discord.Net</title>
<authors>Discord.Net Contributors</authors>
<owners>foxbot</owners>
Expand All @@ -14,45 +14,45 @@
<iconUrl>https://github.com/RogueException/Discord.Net/raw/dev/docs/marketing/logo/PackageLogo.png</iconUrl>
<dependencies>
<group targetFramework="net6.0">
<dependency id="Discord.Net.Core" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Rest" version="3.1.0$suffix$" />
<dependency id="Discord.Net.WebSocket" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Commands" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Webhook" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Interactions" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Core" version="$version$" />
<dependency id="Discord.Net.Rest" version="$version$" />
<dependency id="Discord.Net.WebSocket" version="$version$" />
<dependency id="Discord.Net.Commands" version="$version$" />
<dependency id="Discord.Net.Webhook" version="$version$" />
<dependency id="Discord.Net.Interactions" version="$version$" />
</group>
<group targetFramework="net5.0">
<dependency id="Discord.Net.Core" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Rest" version="3.1.0$suffix$" />
<dependency id="Discord.Net.WebSocket" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Commands" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Webhook" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Interactions" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Core" version="$version$" />
<dependency id="Discord.Net.Rest" version="$version$" />
<dependency id="Discord.Net.WebSocket" version="$version$" />
<dependency id="Discord.Net.Commands" version="$version$" />
<dependency id="Discord.Net.Webhook" version="$version$" />
<dependency id="Discord.Net.Interactions" version="$version$" />
</group>
<group targetFramework="net461">
<dependency id="Discord.Net.Core" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Rest" version="3.1.0$suffix$" />
<dependency id="Discord.Net.WebSocket" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Commands" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Webhook" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Interactions" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Core" version="$version$" />
<dependency id="Discord.Net.Rest" version="$version$" />
<dependency id="Discord.Net.WebSocket" version="$version$" />
<dependency id="Discord.Net.Commands" version="$version$" />
<dependency id="Discord.Net.Webhook" version="$version$" />
<dependency id="Discord.Net.Interactions" version="$version$" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="Discord.Net.Core" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Rest" version="3.1.0$suffix$" />
<dependency id="Discord.Net.WebSocket" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Commands" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Webhook" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Interactions" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Core" version="$version$" />
<dependency id="Discord.Net.Rest" version="$version$" />
<dependency id="Discord.Net.WebSocket" version="$version$" />
<dependency id="Discord.Net.Commands" version="$version$" />
<dependency id="Discord.Net.Webhook" version="$version$" />
<dependency id="Discord.Net.Interactions" version="$version$" />
</group>
<group targetFramework="netstandard2.1">
<dependency id="Discord.Net.Core" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Rest" version="3.1.0$suffix$" />
<dependency id="Discord.Net.WebSocket" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Commands" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Webhook" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Interactions" version="3.1.0$suffix$" />
<dependency id="Discord.Net.Core" version="$version$" />
<dependency id="Discord.Net.Rest" version="$version$" />
<dependency id="Discord.Net.WebSocket" version="$version$" />
<dependency id="Discord.Net.Commands" version="$version$" />
<dependency id="Discord.Net.Webhook" version="$version$" />
<dependency id="Discord.Net.Interactions" version="$version$" />
</group>
</dependencies>
</metadata>
</package>
</package>

0 comments on commit 407ed5e

Please sign in to comment.