Skip to content

Commit

Permalink
fix: Fix NuGet pack
Browse files Browse the repository at this point in the history
  • Loading branch information
dhilgarth committed Mar 20, 2024
1 parent 757355a commit bdc64f1
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 9 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/CI_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,17 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dnversion }}


- name: Restore packages
run: dotnet restore NAudio.Lame.CrossPlatform.sln

- name: Build Nuget package
run: |
VERSION_SUFFIX="/p:Version=${GITHUB_REF#refs/tags/v}"
dotnet pack ./NAudio.Lame/NAudio.Lame.csproj --configuration Release --output ${{ env.NuGetDirectory }} $VERSION_SUFFIX
# Publish the NuGet package as an artifact, so they can be used in the following jobs
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
Expand All @@ -107,7 +110,7 @@ jobs:
dnversion: ['8.0.x']
steps:
# Download the NuGet package created in the previous job
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: nuget
path: ${{ env.NuGetDirectory }}
Expand Down
8 changes: 3 additions & 5 deletions NAudio.Lame/NAudio.Lame.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageId>NAudio.Lame.CrossPlatform</PackageId>
<Title>NAudio.Lame.CrossPlatform</Title>
<PackageProjectUrl>https://github.com/sovarto/NAudio.Lame.CrossPlatform</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/sovarto/NAudio.Lame.CrossPlatform/blob/master/LICENSE.txt</PackageLicenseUrl>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<RepositoryUrl>https://github.com/sovarto/NAudio.Lame.CrossPlatform</RepositoryUrl>
<PackageTags>NAudio MP3 Lame Windows Linux</PackageTags>
<PackageReleaseNotes>v2.2.1 Add Linux support, updated to NAudio 2.2.1.
Expand Down Expand Up @@ -56,15 +56,13 @@ v1.1.0 Changed all projects to .NET STandard 2.0, rebuilt testing using .NET Cor
</ItemGroup>

<ItemGroup>
<None Include="..\LICENSE.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="..\LICENSE.txt" Pack="true" PackagePath="\"/>
<None Include="..\README.md" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\LameDLLWrap\LameDLLWrap.csproj" />
</ItemGroup>

<Import Project="WalkEachTargetPerProject.targets" />
</Project>
166 changes: 166 additions & 0 deletions NAudio.Lame/WalkEachTargetPerProject.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<!-- https://github.com/dotnet/cli/issues/3959 -->
<!-- From https://github.com/leonard-thieu/toofz-data/blob/d9d2c03f9f23de3a3d2b1c7a16d5997a63a31449/src/toofz.Data/WalkEachTargetPerProject.targets -->
<!-- HACK: Uses internal NuGet targets. -->
<Project>
<!-- Remove project references from appearing as dependencies. -->
<Target Name="_RemoveProjectReferences"
AfterTargets="_GenerateRestoreGraph">
<ItemGroup>
<!--
Removing the ProjectReference items directly or setting PrivateAssets to All on them prevents their
dependencies from being added to the restore graph. ProjectReference items become _RestoreGraphEntry
items with Type set to ProjectSpec. This removes their entries after their dependencies have been
added.
-->
<_RemoveRestoreGraphEntry Include="@(_RestoreGraphEntry->WithMetadataValue('Type', 'ProjectSpec'))" />
<!-- All ProjectReference items get included anyway unless the restoring project is not removed. -->
<_RemoveRestoreGraphEntry Remove="@(_RemoveRestoreGraphEntry->WithMetadataValue('ProjectUniqueName', $(MSBuildProjectFullPath)))" />
<_RestoreGraphEntry Remove="@(_RemoveRestoreGraphEntry)" />
</ItemGroup>
</Target>

<Target Name="_CollectPackageReferencesPerProject"
BeforeTargets="CollectPackageReferences">
<!-- NOTE: This doesn't collect package references from projects with PrivateAssets set to All. -->
<MSBuild Projects="@(ProjectReference)"
Targets="CollectPackageReferences">
<Output TaskParameter="TargetOutputs" ItemName="PackageReference" />
</MSBuild>
</Target>

<Target Name="_ExcludeThisBuildOutput"
BeforeTargets="_WalkEachTargetPerFramework">
<PropertyGroup>
<IncludeBuildOutput Condition="'$(IncludeThisBuildOutput)' == 'false'">false</IncludeBuildOutput>
</PropertyGroup>
</Target>

<Target Name="_WalkEachProjectPerFramework"
DependsOnTargets="Restore"
AfterTargets="_WalkEachTargetPerFramework">
<PropertyGroup>
<!-- Include the following outputs in the package. -->
<IncludeBuildOutput Condition="'$(IncludeThisBuildOutput)' == 'false'">true</IncludeBuildOutput>
</PropertyGroup>

<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="__GetBuildOutputFilesWithTfm"
Properties="_TargetFramework=%(_TargetFrameworks.Identity)">
<Output TaskParameter="TargetOutputs" ItemName="_BuildOutputInPackage" />
</MSBuild>

<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="__GetTfmSpecificContentForPackage"
Properties="_TargetFramework=%(_TargetFrameworks.Identity)">
<Output TaskParameter="TargetOutputs" ItemName="_PackageFiles" />
</MSBuild>

<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="__GetDebugSymbolsWithTfm"
Properties="_TargetFramework=%(_TargetFrameworks.Identity)">
<Output TaskParameter="TargetOutputs" ItemName="_TargetPathsToSymbols" />
</MSBuild>

<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="_SourceFilesProjectOutputGroup"
Properties="_TargetFramework=%(_TargetFrameworks.Identity)">
<Output TaskParameter="TargetOutputs" ItemName="_SourceFiles" />
</MSBuild>

<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="__GetFrameworkAssemblyReferences"
Properties="_TargetFramework=%(_TargetFrameworks.Identity)">
<Output TaskParameter="TargetOutputs" ItemName="_FrameworkAssemblyReferences" />
</MSBuild>
</Target>

<!-- Include the output assembly, satellite assemblies, documentation file, and Pri file. -->
<Target Name="__GetBuildOutputFilesWithTfm"
DependsOnTargets="__CollectProjectReferences"
Returns="@(_BuildOutputInPackage)">
<MSBuild Projects="@(_ProjectReference)"
Targets="_GetBuildOutputFilesWithTfm">
<Output TaskParameter="TargetOutputs" ItemName="__BuildOutputInPackage" />
</MSBuild>

<ItemGroup>
<_BuildOutputInPackage Include="@(__BuildOutputInPackage)">
<TargetFramework>$(_TargetFramework)</TargetFramework>
</_BuildOutputInPackage>
</ItemGroup>
</Target>

<!-- Include content files. -->
<Target Name="__GetTfmSpecificContentForPackage"
DependsOnTargets="__CollectProjectReferences"
Returns="@(_PackageFiles)">
<MSBuild Projects="@(_ProjectReference)"
Targets="_GetTfmSpecificContentForPackage">
<Output TaskParameter="TargetOutputs" ItemName="__PackageFiles" />
</MSBuild>

<ItemGroup>
<_PackageFiles Include="@(__PackageFiles)">
<TargetFramework>$(_TargetFramework)</TargetFramework>
</_PackageFiles>
</ItemGroup>
</Target>

<!-- Include debug symbols. -->
<Target Name="__GetDebugSymbolsWithTfm"
DependsOnTargets="__CollectProjectReferences"
Returns="@(_TargetPathsToSymbols)">
<MSBuild Projects="@(_ProjectReference)"
Targets="_GetDebugSymbolsWithTfm">
<Output TaskParameter="TargetOutputs" ItemName="__TargetPathsToSymbols" />
</MSBuild>

<ItemGroup>
<_TargetPathsToSymbols Include="@(__TargetPathsToSymbols)">
<TargetFramework>$(_TargetFramework)</TargetFramework>
</_TargetPathsToSymbols>
</ItemGroup>
</Target>

<!-- Include source files. -->
<!-- NOTE: Don't think this works correctly. -->
<Target Name="_SourceFilesProjectOutputGroup"
DependsOnTargets="__CollectProjectReferences"
Returns="@(_SourceFiles)">
<MSBuild Projects="@(_ProjectReference)"
Targets="SourceFilesProjectOutputGroup"
Properties="BuildProjectReferences=false"
Condition="'$(IncludeSource)' == 'true'">
<Output TaskParameter="TargetOutputs" ItemName="__SourceFiles" />
</MSBuild>

<ItemGroup>
<_SourceFiles Include="@(__SourceFiles)">
<TargetFramework>$(_TargetFramework)</TargetFramework>
</_SourceFiles>
</ItemGroup>
</Target>

<!-- Include framework assembly references. -->
<Target Name="__GetFrameworkAssemblyReferences"
DependsOnTargets="__CollectProjectReferences"
Returns="@(_FrameworkAssemblyReferences)">
<MSBuild Projects="$(_ProjectReference)"
Targets="_GetFrameworkAssemblyReferences"
Properties="BuildProjectReferences=false">
<Output TaskParameter="TargetOutputs" ItemName="_FrameworkAssemblyReferences" />
</MSBuild>
</Target>

<Target Name="__CollectProjectReferences"
Returns="@(_ProjectReference)">
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="_CollectProjectReferences"
Properties="TargetFramework=$(_TargetFramework)">
<Output TaskParameter="TargetOutputs" ItemName="_ProjectReference" />
</MSBuild>
</Target>

<Target Name="_CollectProjectReferences"
Returns="@(ProjectReference)" />
</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# NAudio.Lame
[![Build Status](https://github.com/sovarto/NAudio.Lame.CrossPlatform/actions/workflows/CI_Net8.yml/badge.svg)](https://github.com/sovarto/NAudio.Lame.CrossPlatform/actions?workflow=publish)
[![Build Status](https://github.com/sovarto/NAudio.Lame.CrossPlatform/actions/workflows/CI_publish.yml/badge.svg)](https://github.com/sovarto/NAudio.Lame.CrossPlatform/actions?workflow=publish)
## Description

Wrapper for `libmp3lame` to add MP3 encoding support to NAudio 2.x on Windows and Linux.
Expand Down

0 comments on commit bdc64f1

Please sign in to comment.