Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,27 @@ jobs:

- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
run: |
VERSION=${GITHUB_REF#refs/tags/v}
PREFIX=${VERSION%%-*}
SUFFIX=""
if [[ "$VERSION" == *-* ]]; then
SUFFIX=${VERSION#*-}
fi
echo "PREFIX=$PREFIX" >> $GITHUB_OUTPUT
echo "SUFFIX=$SUFFIX" >> $GITHUB_OUTPUT

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore
run: dotnet build --configuration Release --no-restore -p:VersionPrefix=${{ steps.version.outputs.PREFIX }} -p:VersionSuffix=${{ steps.version.outputs.SUFFIX }}

- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal

- name: Pack
run: dotnet pack --configuration Release --no-build --output ./nupkg /p:PackageVersion=${{ steps.version.outputs.VERSION }}
run: dotnet pack --configuration Release --no-build --output ./nupkg

- name: Push to NuGet
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
Expand Down
22 changes: 22 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<!-- Versioning. VersionPrefix is overridden in CI from the git tag and drives
PackageVersion (via Version) and InformationalVersion. AssemblyVersion is
pinned so strong-named .NET Framework consumers don't need binding-redirect
updates on every patch release - bump it only on breaking changes.
FileVersion is set explicitly because the SDK defaults FileVersion to
AssemblyVersion when AssemblyVersion is set, which would freeze it at 1.0.0.0. -->
<PropertyGroup>
<VersionPrefix>1.0.0</VersionPrefix>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>$(VersionPrefix).0</FileVersion>
</PropertyGroup>

<!-- SourceLink and Symbol Packages -->
<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -26,6 +38,16 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<!-- Strong-name signing (required so .NET Framework consumers that are themselves
strong-named can reference these assemblies). Examples opt out via their own
Directory.Build.props. NginxApiClientPublicKey is the full public key from
NginxApiClient-KeyFile.snk and is referenced by InternalsVisibleTo entries. -->
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)NginxApiClient-KeyFile.snk</AssemblyOriginatorKeyFile>
<NginxApiClientPublicKey>00240000048000009400000006020000002400005253413100040000010001006925f3c2d5b1d9d2e8f1652e5b23f223390e09b94ee66a09657c6cdff11ec6a428188a58073e5029240e2d6844b7e50f25b6dd48ed1e536a7c4ad2d0ffa8617371fa8601bc5bf32c50dbd702bebd07dd999e589ac6fe9f380e325c9c6f38ea8ce7653f15932ab0c53c2d27c8a10a51dcc8ce876699a94b2c09879b2368f2f3a7</NginxApiClientPublicKey>
</PropertyGroup>

<!-- Nullable reference types for supported targets -->
<PropertyGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
<Nullable>enable</Nullable>
Expand Down
Binary file added NginxApiClient-KeyFile.snk
Binary file not shown.
9 changes: 9 additions & 0 deletions examples/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>

</Project>
8 changes: 4 additions & 4 deletions src/NginxApiClient/NginxApiClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="NginxApiClient.Tests" />
<InternalsVisibleTo Include="NginxApiClient.IntegrationTests" />
<InternalsVisibleTo Include="NginxApiClient.SystemTextJson" />
<InternalsVisibleTo Include="NginxApiClient.NewtonsoftJson" />
<InternalsVisibleTo Include="NginxApiClient.Tests" Key="$(NginxApiClientPublicKey)" />
<InternalsVisibleTo Include="NginxApiClient.IntegrationTests" Key="$(NginxApiClientPublicKey)" />
<InternalsVisibleTo Include="NginxApiClient.SystemTextJson" Key="$(NginxApiClientPublicKey)" />
<InternalsVisibleTo Include="NginxApiClient.NewtonsoftJson" Key="$(NginxApiClientPublicKey)" />
</ItemGroup>

</Project>
Loading