diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d153f70..b4857d67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,9 @@ jobs: - name: Test run: dotnet test --no-build --configuration Release --verbosity normal --logger "trx;LogFileName=test-results.trx" + - name: Pack (verify NuGet package) + run: dotnet pack src/MiniPdf/MiniPdf.csproj --no-build --configuration Release --output ./nupkg + - name: Upload test results uses: actions/upload-artifact@v4 if: always() diff --git a/.github/workflows/nuget-publish.yml b/.github/workflows/nuget-publish.yml new file mode 100644 index 00000000..9221c1f0 --- /dev/null +++ b/.github/workflows/nuget-publish.yml @@ -0,0 +1,40 @@ +name: NuGet Publish + +on: + release: + types: [ published ] + +permissions: + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore --configuration Release + + - name: Test + run: dotnet test --no-build --configuration Release --verbosity normal + + - 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 + + - name: Push to NuGet.org + run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/README.md b/README.md index a172b630..e281c996 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,12 @@ A minimal, zero-dependency .NET library for generating PDF documents from text a ## Getting Started +### Install via NuGet + +```bash +dotnet add package MiniPdf +``` + ### Requirements - .NET 9.0 or later diff --git a/src/MiniPdf/MiniPdf.csproj b/src/MiniPdf/MiniPdf.csproj index 2c981851..65fccc18 100644 --- a/src/MiniPdf/MiniPdf.csproj +++ b/src/MiniPdf/MiniPdf.csproj @@ -9,9 +9,18 @@ MiniPdf 0.1.0 + shps951023 A minimal, zero-dependency .NET library for generating PDF documents from text and Excel files. - pdf;excel;xlsx;converter;text + pdf;excel;xlsx;converter;text;minipdf MIT + https://github.com/shps951023/MiniPdf + https://github.com/shps951023/MiniPdf.git + git + README.md + + + +