From 5f1c424020b3c51e47cd8055ae0c01719664829e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Mar 2026 18:06:01 +0000 Subject: [PATCH 1/2] Initial plan From 7b32b8a1333f0fcffb6a78c11ec910681cd720de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Mar 2026 18:08:37 +0000 Subject: [PATCH 2/2] Add .NET 8 class-library scaffolding and GitHub Packages publish workflow Co-authored-by: kylemwhite <4984480+kylemwhite@users.noreply.github.com> --- .github/workflows/publish.yml | 75 +++++++++++++++++++++++++++++++++++ .gitignore | 5 ++- src/mdz-core/mdz-core.csproj | 24 +++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml create mode 100644 src/mdz-core/mdz-core.csproj diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..aafe236 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,75 @@ +name: Publish NuGet Package to GitHub Packages + +on: + push: + branches: + - main + tags: + - "v*.*.*" + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + + # Derive a version from the git tag (e.g. v1.2.3 → 1.2.3). + # Falls back to 1.0.0 for plain branch pushes. + - name: Determine package version + id: version + run: | + if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then + VERSION="${GITHUB_REF_NAME#v}" + else + VERSION="1.0.0" + fi + echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT" + + - name: Restore dependencies + run: dotnet restore src/mdz-core/mdz-core.csproj + + - name: Build (Release) + run: dotnet build src/mdz-core/mdz-core.csproj --configuration Release --no-restore + + # Run tests only when a test project is present + - name: Run tests + run: | + if find tests -name '*.csproj' -print -quit 2>/dev/null | grep -q .; then + dotnet test tests --configuration Release --verbosity normal + else + echo "No test projects found – skipping test step." + fi + + - name: Pack + run: > + dotnet pack src/mdz-core/mdz-core.csproj + --configuration Release + --no-build + -p:Version=${{ steps.version.outputs.VERSION }} + -o out + + - name: Add GitHub Packages source + run: > + dotnet nuget add source + https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json + --name github + --username ${{ github.actor }} + --password ${{ secrets.GITHUB_TOKEN }} + --store-password-in-clear-text + + - name: Publish to GitHub Packages + run: > + dotnet nuget push out/*.nupkg + --source github + --api-key ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 35063fc..e62b8d2 100644 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,7 @@ CodeCoverage/ # NUnit *.VisualState.xml TestResult.xml -nunit-*.xml \ No newline at end of file +nunit-*.xml + +# Pack output (dotnet pack -o out) +out/ \ No newline at end of file diff --git a/src/mdz-core/mdz-core.csproj b/src/mdz-core/mdz-core.csproj new file mode 100644 index 0000000..08800a2 --- /dev/null +++ b/src/mdz-core/mdz-core.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + enable + enable + + + mdz-core + 1.0.0 + + + Core library assembly for the .mdz format. + https://github.com/kylemwhite/mdz-core + git + + + false + + + true + + +