Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeugma440 committed Feb 4, 2025
2 parents 853a893 + a2022a2 commit 675dd1c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 9 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/nuget_build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Publish to NuGet Gallery"

on:
release:
types: [published]

env:
PROJECT_PATH: ATL/ATL.csproj
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/build-output
NUGET_SOURCE_URL: "https://api.nuget.org/v3/index.json"

jobs:
publish:
name: "Publish to NuGet Gallery"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Install Dotnet"
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: "Create NuGet release note file"
run: |
echo "${{ github.event.release.body }}" > PACKAGE-RELEASE-NOTES.txt
- name: "Restore packages"
run: dotnet restore "${{ env.PROJECT_PATH }}"

- name: "Build project"
run: dotnet build "${{ env.PROJECT_PATH }}" --no-restore --configuration Release -p:Version=${{ github.event.release.tag_name }} -p:FileVersion=${{ github.event.release.tag_name }}

- name: "Pack project"
run: dotnet pack "${{ env.PROJECT_PATH }}" -p:PackageVersion=${{ github.event.release.tag_name }} --no-restore --no-build --configuration Release --output "${{ env.PACKAGE_OUTPUT_DIRECTORY }}"

- name: "Push package"
run: dotnet nuget push "${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg" --source ${{ env.NUGET_SOURCE_URL }} --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate
45 changes: 36 additions & 9 deletions ATL/ATL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,46 @@
<PackageId>z440.atl.core</PackageId>
<PackageVersion>6.16.0</PackageVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageTags>audio metadata tag mp3 mp4 aac id3v2 ogg vorbis opus flac playlist cue</PackageTags>
<PackageLicenseUrl></PackageLicenseUrl>
<PackageTags>audio;metadata;tag;mp3;mp4;aac;id3v2;ogg;vorbis;opus;flac;playlist;cue</PackageTags>
<PackageProjectUrl>https://github.com/Zeugma440/atldotnet</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Zeugma440/atldotnet.git</RepositoryUrl>
<Authors>Zeugma440</Authors>
<Product>Audio Tools Library (ATL) for .NET</Product>
<FileVersion>6.16.0.0</FileVersion>
<PackageReleaseNotes></PackageReleaseNotes>
<Version>6.16.0</Version>
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net30|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup>
<!-- Explicitly generate Assembly Info -->
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl></RepositoryUrl>
<RepositoryType></RepositoryType>
<Copyright>Zeugma440</Copyright>
</PropertyGroup>

<!-- Ensure nuget show deterministic tag as valid, https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/#deterministic-builds -->
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup>
<DebugType>embedded</DebugType>
<Deterministic>True</Deterministic>
</PropertyGroup>

<!-- Original / source : https://dev.to/j_sakamoto/writing-a-nuget-package-release-notes-in-an-outside-of-a-csproj-file-3f94 -->
<Target Name="PreparePackageReleaseNotesFromFile" BeforeTargets="GenerateNuspec">
<ReadLinesFromFile File="../PACKAGE-RELEASE-NOTES.txt">
<Output TaskParameter="Lines" ItemName="ReleaseNoteLines" />
</ReadLinesFromFile>
<PropertyGroup>
 <!-- Add new line character between each lines -->
<PackageReleaseNotes>@(ReleaseNoteLines, '%0a')</PackageReleaseNotes>
</PropertyGroup>
</Target>

<ItemGroup>
<InternalsVisibleTo Include="ATL.unit-test" />
</ItemGroup>
Expand Down Expand Up @@ -68,4 +85,14 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<!-- Include README in the nuget package -->
<None Include="../README.md" Pack="true" PackagePath="/" />

<!-- Copy README to the build output directory -->
<None Include="../README.md">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

0 comments on commit 675dd1c

Please # to comment.