Skip to content

feat: add NuGet package support#41

Merged
shps951023 merged 1 commit intomini-software:mainfrom
openaitx-system:feature/nuget-package
Feb 22, 2026
Merged

feat: add NuGet package support#41
shps951023 merged 1 commit intomini-software:mainfrom
openaitx-system:feature/nuget-package

Conversation

@openaitx-system
Copy link
Copy Markdown
Collaborator

Summary

Add NuGet package publishing infrastructure for MiniPdf.

Changes

  • MiniPdf.csproj: Added complete NuGet metadata (Authors, RepositoryUrl, RepositoryType, PackageProjectUrl, PackageReadmeFile)
  • nuget-publish.yml: New GitHub Actions workflow that automatically publishes to NuGet.org when a GitHub Release is created
  • ci.yml: Added dotnet pack verification step so every CI build ensures the package can be packed successfully
  • README.md: Added dotnet add package MiniPdf install instructions

How to publish a new version

  1. Update <Version> in src/MiniPdf/MiniPdf.csproj
  2. Create a GitHub Release with a tag like v0.2.0
  3. The nuget-publish.yml workflow will automatically pack and push to NuGet.org

Required secret

  • NUGET_API_KEY — NuGet.org API key with push permission for the MiniPdf package

Closes #5

- Add complete NuGet metadata (Authors, RepositoryUrl, PackageReadmeFile) to MiniPdf.csproj
- Add nuget-publish.yml workflow: auto-publish to NuGet.org on GitHub release
- Add pack verification step to CI build
- Add NuGet install instructions to README

Closes mini-software#5
Copilot AI review requested due to automatic review settings February 22, 2026 16:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds NuGet packaging and publishing automation for the MiniPdf library, enabling release-driven publishing to NuGet.org and CI verification that the project can be packed.

Changes:

  • Added NuGet package metadata (authors, repo URLs, readme) to MiniPdf.csproj and included the root README.md in the package.
  • Introduced a nuget-publish.yml workflow to pack and push on GitHub Release publish.
  • Updated CI to run dotnet pack as a packaging sanity check, and updated README with NuGet install instructions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/MiniPdf/MiniPdf.csproj Adds NuGet metadata and attempts to include the repository README in the produced package.
README.md Documents installing MiniPdf from NuGet.
.github/workflows/nuget-publish.yml Implements release-triggered pack + publish to NuGet.org.
.github/workflows/ci.yml Adds a dotnet pack step to ensure packaging succeeds in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PackagePath="\" uses a Windows-style separator and can end up creating an unexpected folder name inside the .nupkg on non-Windows platforms. For packing the README at the package root (to match PackageReadmeFile), use an empty PackagePath (or /) instead.

Suggested change
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="" />

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +37
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT

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

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow sets PackageVersion from the Git tag, but the PR description instructs maintainers to update <Version> in MiniPdf.csproj. As-is, those can diverge (CI packing uses the csproj version, while publishing uses the tag). Consider either (1) relying on the csproj <Version> and dropping the -p:PackageVersion=... override, or (2) adding a validation step that fails if the tag version doesn't match the csproj version, and update the publish instructions accordingly.

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +35
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT

Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERSION=${GITHUB_REF_NAME#v} assumes the tag is prefixed with v and doesn't validate the result. If the release tag is missing the prefix (or is just v), the version passed to dotnet pack can become invalid/empty and fail in a confusing way. Consider adding a small validation step to assert the extracted version is non-empty and matches an expected NuGet/SemVer pattern before packing.

Suggested change
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
run: |
RAW_TAG="${GITHUB_REF_NAME}"
VERSION="${RAW_TAG#v}"
if [ -z "$VERSION" ]; then
echo "Error: Extracted version is empty. Ensure the release tag is of the form 'v<version>' (e.g., 'v1.2.3')."
exit 1
fi
if ! echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$'; then
echo "Error: Extracted version '$VERSION' is not a valid SemVer/NuGet version (expected format: MAJOR.MINOR.PATCH[-PRERELEASE])."
exit 1
fi
echo "Using version: $VERSION"
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"

Copilot uses AI. Check for mistakes.
@shps951023 shps951023 merged commit f5d78f6 into mini-software:main Feb 22, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NuGet Package

3 participants