diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2068cbd..2ac4bf0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,13 +17,37 @@ jobs: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Pack + uses: devcontainers/ci@v0.3 + env: + NUGET_AUTHORS: ${{ github.repository_owner }} + with: + imageName: ghcr.io/${{ env.GITHUB_REPOSITORY }}/devcontainer + cacheFrom: ghcr.io/${{ env.GITHUB_REPOSITORY }}/devcontainer + push: never + runCmd: pnpm run pack + env: | + NUGET_AUTHORS + + - name: Upload NuGet Package + uses: actions/upload-artifact@v4 + with: + name: nuget-package + path: .local/packages/* - name: Publish uses: devcontainers/ci@v0.3 env: + NUGET_AUTHORS: ${{ github.repository_owner }} NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} with: imageName: ghcr.io/${{ env.GITHUB_REPOSITORY }}/devcontainer cacheFrom: ghcr.io/${{ env.GITHUB_REPOSITORY }}/devcontainer push: never runCmd: pnpm run publish + env: | + NUGET_AUTHORS + NUGET_API_KEY diff --git a/Automation/Pack.cs b/Automation/Pack.cs index 15bcf74..66186e0 100644 --- a/Automation/Pack.cs +++ b/Automation/Pack.cs @@ -1,3 +1,4 @@ +using Cake.Common.Diagnostics; using Cake.Common.IO; using Cake.Common.Tools.DotNet; using Cake.Frosting; @@ -12,7 +13,12 @@ public override void Run(Context context) context.CleanDirectory(Context.PackagesDirectory); using var repository = new Git.Repository(Context.ProjectRoot); - string authors = repository.Config.Get("user.name").Value; + string authors = + Environment.GetEnvironmentVariable("NUGET_AUTHORS") + ?? repository.Config.Get("user.name")?.Value ?? throw new InvalidOperationException( + "Could not retrieve authors." + ); + context.Information($"Authors: {authors}"); context.DotNetPack( Path.Combine(Context.ProjectRoot, "Divert.Windows"), diff --git a/ReadMe.md b/ReadMe.md index 8dffa1b..3cd32fb 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -5,10 +5,12 @@ [Codecov Badge]: https://img.shields.io/codecov/c/github/gdlol/Divert.Windows [Codecov URL]: https://codecov.io/gh/gdlol/Divert.Windows [License Badge]: https://img.shields.io/github/license/gdlol/Divert.Windows +[NuGet Version]: https://img.shields.io/nuget/v/Divert.Windows [![CI Badge][CI Badge]][CI URL] [![Codecov Badge][Codecov Badge]][Codecov URL] [![License Badge][License Badge]](LICENSE) +[![NuGet Version][NuGet Version]](https://www.nuget.org/packages/Divert.Windows) High quality .NET APIs for WinDivert.