Skip to content

Commit 675dd1c

Browse files
committed
2 parents 853a893 + a2022a2 commit 675dd1c

File tree

2 files changed

+75
-9
lines changed

2 files changed

+75
-9
lines changed
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Publish to NuGet Gallery"
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
PROJECT_PATH: ATL/ATL.csproj
9+
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/build-output
10+
NUGET_SOURCE_URL: "https://api.nuget.org/v3/index.json"
11+
12+
jobs:
13+
publish:
14+
name: "Publish to NuGet Gallery"
15+
runs-on: "ubuntu-latest"
16+
steps:
17+
- name: "Checkout"
18+
uses: actions/checkout@v4
19+
20+
- name: "Install Dotnet"
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: "8.0.x"
24+
25+
- name: "Create NuGet release note file"
26+
run: |
27+
echo "${{ github.event.release.body }}" > PACKAGE-RELEASE-NOTES.txt
28+
29+
- name: "Restore packages"
30+
run: dotnet restore "${{ env.PROJECT_PATH }}"
31+
32+
- name: "Build project"
33+
run: dotnet build "${{ env.PROJECT_PATH }}" --no-restore --configuration Release -p:Version=${{ github.event.release.tag_name }} -p:FileVersion=${{ github.event.release.tag_name }}
34+
35+
- name: "Pack project"
36+
run: dotnet pack "${{ env.PROJECT_PATH }}" -p:PackageVersion=${{ github.event.release.tag_name }} --no-restore --no-build --configuration Release --output "${{ env.PACKAGE_OUTPUT_DIRECTORY }}"
37+
38+
- name: "Push package"
39+
run: dotnet nuget push "${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg" --source ${{ env.NUGET_SOURCE_URL }} --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate

ATL/ATL.csproj

+36-9
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,46 @@
88
<PackageId>z440.atl.core</PackageId>
99
<PackageVersion>6.16.0</PackageVersion>
1010
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
11-
<PackageTags>audio metadata tag mp3 mp4 aac id3v2 ogg vorbis opus flac playlist cue</PackageTags>
12-
<PackageLicenseUrl></PackageLicenseUrl>
11+
<PackageTags>audio;metadata;tag;mp3;mp4;aac;id3v2;ogg;vorbis;opus;flac;playlist;cue</PackageTags>
1312
<PackageProjectUrl>https://github.com/Zeugma440/atldotnet</PackageProjectUrl>
13+
<PackageReadmeFile>README.md</PackageReadmeFile>
14+
<RepositoryType>git</RepositoryType>
15+
<RepositoryUrl>https://github.com/Zeugma440/atldotnet.git</RepositoryUrl>
1416
<Authors>Zeugma440</Authors>
1517
<Product>Audio Tools Library (ATL) for .NET</Product>
16-
<FileVersion>6.16.0.0</FileVersion>
1718
<PackageReleaseNotes></PackageReleaseNotes>
1819
<Version>6.16.0</Version>
1920
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
2021
</PropertyGroup>
21-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net30|AnyCPU'">
22-
<DebugType>full</DebugType>
23-
<DebugSymbols>true</DebugSymbols>
24-
</PropertyGroup>
2522

2623
<PropertyGroup>
2724
<!-- Explicitly generate Assembly Info -->
2825
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
2926
<PackageLicenseExpression>MIT</PackageLicenseExpression>
30-
<RepositoryUrl></RepositoryUrl>
31-
<RepositoryType></RepositoryType>
27+
<Copyright>Zeugma440</Copyright>
28+
</PropertyGroup>
29+
30+
<!-- Ensure nuget show deterministic tag as valid, https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/#deterministic-builds -->
31+
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
32+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
33+
</PropertyGroup>
34+
35+
<PropertyGroup>
36+
<DebugType>embedded</DebugType>
37+
<Deterministic>True</Deterministic>
3238
</PropertyGroup>
3339

40+
<!-- Original / source : https://dev.to/j_sakamoto/writing-a-nuget-package-release-notes-in-an-outside-of-a-csproj-file-3f94 -->
41+
<Target Name="PreparePackageReleaseNotesFromFile" BeforeTargets="GenerateNuspec">
42+
<ReadLinesFromFile File="../PACKAGE-RELEASE-NOTES.txt">
43+
<Output TaskParameter="Lines" ItemName="ReleaseNoteLines" />
44+
</ReadLinesFromFile>
45+
<PropertyGroup>
46+
 <!-- Add new line character between each lines -->
47+
<PackageReleaseNotes>@(ReleaseNoteLines, '%0a')</PackageReleaseNotes>
48+
</PropertyGroup>
49+
</Target>
50+
3451
<ItemGroup>
3552
<InternalsVisibleTo Include="ATL.unit-test" />
3653
</ItemGroup>
@@ -68,4 +85,14 @@
6885
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
6986
</EmbeddedResource>
7087
</ItemGroup>
88+
89+
<ItemGroup>
90+
<!-- Include README in the nuget package -->
91+
<None Include="../README.md" Pack="true" PackagePath="/" />
92+
93+
<!-- Copy README to the build output directory -->
94+
<None Include="../README.md">
95+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
96+
</None>
97+
</ItemGroup>
7198
</Project>

0 commit comments

Comments
 (0)