From 0d30b8f4444ba66d120280db2e673c14994b5b70 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 8 Jan 2025 21:09:37 +0100 Subject: [PATCH] Add NerdBank.GitVersioning support This commit adds [NerdBank.GitVersioning](https://www.nuget.org/packages/Nerdbank.GitVersioning), which gives every build of plist-cil a unique version number. The base version number is stored in `version.json` (e.g. 2.2) and is incremented by 1 every time a commit is added. Builds off branches contain a `+g{commit}` suffix, indicating that these builds are prerelease. This makes it easier to keep track of different versions of plist-cil. --- .github/workflows/ci.yaml | 5 ++++- plist-cil/plist-cil.csproj | 1 + version.json | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 version.json diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 23caaa7..a9682b9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,10 +23,13 @@ jobs: - name: Create NuGet packages run: | dotnet pack -c Release -o nuget/ + - name: Get version information + uses: dotnet/nbgv@master + id: nbgv - name: Publish NuGet packages as artifacts uses: actions/upload-artifact@v3 with: - name: plist-cil + name: plist-cil-${{ steps.nbgv.outputs.SemVer2 }} path: nuget/ - name: Publish NuGet packages to NuGet feed run: | diff --git a/plist-cil/plist-cil.csproj b/plist-cil/plist-cil.csproj index bbe0c38..788fa4a 100644 --- a/plist-cil/plist-cil.csproj +++ b/plist-cil/plist-cil.csproj @@ -48,6 +48,7 @@ Add .NET 5.0 support. + diff --git a/version.json b/version.json new file mode 100644 index 0000000..eabfd33 --- /dev/null +++ b/version.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "2.2", + "publicReleaseRefSpec": [ + "^refs/heads/master$", + "^refs/heads/releases/*" + ] +} \ No newline at end of file