From 9285e936bab899e9ef95be17a215cbe7960dde87 Mon Sep 17 00:00:00 2001 From: Robert Bill <147130488+RobSlgm@users.noreply.github.com> Date: Wed, 29 Apr 2026 16:12:40 +0200 Subject: [PATCH 1/2] Update workflow actions --- .github/workflows/dotnet.yml | 4 ++-- .github/workflows/publish-release.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index ca75dba..233ebbe 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -25,7 +25,7 @@ jobs: cache: true cache-dependency-path: "**/packages.lock.json" - - uses: dotnet/nbgv@v0.4.2 + - uses: dotnet/nbgv@v0.5.1 id: nbgv with: setAllVars: true @@ -40,7 +40,7 @@ jobs: run: dotnet test --no-build -c Release --verbosity normal - name: Upload Nuget package as Artifact - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v6 with: name: ClosureOSS.Calendare.VSyntaxReader.${{ steps.nbgv.outputs.NuGetPackageVersion }} path: ./artifacts/package/release/*nupkg diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index c19ad15..ebdb1be 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -27,7 +27,7 @@ jobs: cache: true cache-dependency-path: '**/packages.lock.json' - - uses: dotnet/nbgv@v0.4.2 + - uses: dotnet/nbgv@v0.5.1 id: nbgv with: setAllVars: true @@ -116,7 +116,7 @@ jobs: - name: Create Release id: create_release - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@v3 with: name: ${{ steps.nbgv.outputs.SemVer2 }} tag_name: ${{ steps.nbgv.outputs.SemVer2 }} From a8751d9d8930ceab7694814bab4e48cf10f45886 Mon Sep 17 00:00:00 2001 From: Robert Bill <147130488+RobSlgm@users.noreply.github.com> Date: Mon, 4 May 2026 09:59:49 +0200 Subject: [PATCH 2/2] Replace nbgv with gitversion --- .github/workflows/dotnet.yml | 29 +++-- .github/workflows/publish-release.yml | 129 ---------------------- .github/workflows/release-nuget.yml | 65 +++++++++++ Directory.Build.props | 13 +-- GitVersion.yaml | 5 + VSyntaxReader.Examples/packages.lock.json | 8 +- VSyntaxReader.Tests/packages.lock.json | 12 +- VSyntaxReader/packages.lock.json | 36 +++--- version.json | 17 --- 9 files changed, 125 insertions(+), 189 deletions(-) delete mode 100644 .github/workflows/publish-release.yml create mode 100644 .github/workflows/release-nuget.yml create mode 100644 GitVersion.yaml delete mode 100644 version.json diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 233ebbe..56f9498 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,7 +1,8 @@ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net -name: 🏭 Build +name: 🏭 Build nuget on: + workflow_dispatch: push: branches: - main @@ -9,6 +10,14 @@ on: branches: - main +env: + DOTNET_VERSION: "10.x" + NUGET_PACKAGE_NAME: "ClosureOSS.Calendare.VSyntaxReader" + +permissions: + contents: write + pull-requests: read + jobs: build: runs-on: ubuntu-latest @@ -21,18 +30,22 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: 10.x + dotnet-version: ${{ env.DOTNET_VERSION }} cache: true cache-dependency-path: "**/packages.lock.json" - - uses: dotnet/nbgv@v0.5.1 - id: nbgv - with: - setAllVars: true - - name: Restore dependencies run: dotnet restore --locked-mode + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v4.5.0 + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v4.5.0 + with: + updateProjectFiles: true + - name: Build run: dotnet build --no-restore -c Release @@ -42,6 +55,6 @@ jobs: - name: Upload Nuget package as Artifact uses: actions/upload-artifact@v6 with: - name: ClosureOSS.Calendare.VSyntaxReader.${{ steps.nbgv.outputs.NuGetPackageVersion }} + name: ${{ env.NUGET_PACKAGE_NAME }}.${{ steps.gitversion.outputs.FullSemVer }} path: ./artifacts/package/release/*nupkg retention-days: 1 diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml deleted file mode 100644 index ebdb1be..0000000 --- a/.github/workflows/publish-release.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: 🎁 Release - -on: - workflow_dispatch: - push: - branches: - - release/* - -permissions: - contents: write - pull-requests: read - -jobs: - publish: - runs-on: ubuntu-latest - environment: public-release - - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: 10.x - cache: true - cache-dependency-path: '**/packages.lock.json' - - - uses: dotnet/nbgv@v0.5.1 - id: nbgv - with: - setAllVars: true - - - name: Restore dependencies - run: dotnet restore --locked-mode - - - name: Build - run: dotnet build --no-restore -c Release - - - name: Test - run: dotnet test --no-build -c Release --verbosity normal - - # Get previous tag of the release stream (x.y.z) for changelog - # HINT: for last tag use .SemVer2 instead filtering all pre-release tags (with hyphen) - - name: Get Previous Tag - id: previous_tag - run: | - PREV=$(git tag --sort=-creatordate | grep -v -e "-" | head -n 1) - echo "${PREV} to ${{ steps.nbgv.outputs.SemVer2 }}" - echo "tag=$PREV" >> $GITHUB_OUTPUT - - - name: Create and push tag - run: | - echo "${{ steps.nbgv.outputs.SemVer2 }}" - git tag "${{ steps.nbgv.outputs.SemVer2 }}" - git push origin "${{ steps.nbgv.outputs.SemVer2 }}" - - - name: Publish the package to NUGET - run: dotnet nuget push ./artifacts/package/release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key $NUGET_AUTH_TOKEN --skip-duplicate - env: - NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} - - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@v6 - with: - ignorePreReleases: true - fromTag: ${{ steps.previous_tag.outputs.tag }} - toTag: ${{ steps.nbgv.outputs.SemVer2 }} - configurationJson: | - { - "template": "## What's Changed\n#{{CHANGELOG}}\n\n### 👀 Uncategorized\n#{{UNCATEGORIZED}}\n**Full Changelog**: #{{RELEASE_DIFF}}", - "categories": [ - { - "title": "### Breaking Changes 🛠", - "labels": ["breaking-change"] - }, - { - "title": "### 🎉 Feature", - "labels": ["feat", "feature", "enhancement"] - }, - { - "title": "### 🔒 Security", - "labels": ["security"] - }, - { - "title": "### 🐛 Bug", - "labels": ["fix", "bug"] - }, - { - "title": "### ✅ Testing", - "labels": ["testing"] - }, - { - "title": "### 💬 Other", - "labels": ["other", "chore"] - }, - { - "title": "### 📦 Dependencies", - "labels": ["dependencies", "deps"] - } - ], - "label_extractor": [ - { - "method": "regexr", - "pattern": "\\[(.+?)\\].+", - "target": "$1", - "on_property": "title" - } - ], - "pr_template": "* #{{TITLE}} by @#{{AUTHOR}} in ##{{NUMBER}}" - } - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - id: create_release - uses: softprops/action-gh-release@v3 - with: - name: ${{ steps.nbgv.outputs.SemVer2 }} - tag_name: ${{ steps.nbgv.outputs.SemVer2 }} - target_commitish: ${{ github.ref }} - # generate_release_notes: true - body: ${{steps.github_release.outputs.changelog}} - files: ./artifacts/package/release/*nupkg - prerelease: ${{ contains(steps.nbgv.outputs.SemVer2, '-') }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-nuget.yml b/.github/workflows/release-nuget.yml new file mode 100644 index 0000000..b793012 --- /dev/null +++ b/.github/workflows/release-nuget.yml @@ -0,0 +1,65 @@ +name: 🎁 Publish nuget package + +on: + push: + tags: + - "v[0-9]*.[0-9]*.[0-9]*" # Pattern for standard: v1.2.3 + - "v[0-9]*.[0-9]*.[0-9]*-*" # Pattern for pre-release: v1.2.3-alpha.1 + +env: + DOTNET_VERSION: "10.x" + +permissions: + contents: write + pull-requests: read + +jobs: + publish: + runs-on: ubuntu-latest + environment: public-release + + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + cache: true + cache-dependency-path: '**/packages.lock.json' + + - name: Restore dependencies + run: dotnet restore --locked-mode + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v4.5.0 + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v4.5.0 + with: + updateProjectFiles: true + + - name: Build + run: dotnet build --no-restore -c Release + + - name: Test + run: dotnet test --no-build -c Release --verbosity normal + + - name: Publish the package to NUGET + run: dotnet nuget push ./artifacts/package/release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key $NUGET_AUTH_TOKEN --skip-duplicate + env: + NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v3 + with: + tag_name: ${{ github.ref_name }} + name: "${{ github.ref_name }}" + generate_release_notes: true + files: ./artifacts/package/release/*nupkg + prerelease: ${{ steps.gitversion.outputs.PreReleaseTag != '' }} diff --git a/Directory.Build.props b/Directory.Build.props index 75fdc0c..ad4c125 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,14 +1,8 @@  - - - all - 3.9.50 - - closure.ch - © 2024-2025 Robert Bill + © 2024-2026 Robert Bill Robert Bill @@ -16,4 +10,9 @@ true true + + + All + + \ No newline at end of file diff --git a/GitVersion.yaml b/GitVersion.yaml new file mode 100644 index 0000000..e611680 --- /dev/null +++ b/GitVersion.yaml @@ -0,0 +1,5 @@ +workflow: GitHubFlow/v1 +mode: ContinuousDelivery +branches: + feature: + mode: ContinuousDelivery diff --git a/VSyntaxReader.Examples/packages.lock.json b/VSyntaxReader.Examples/packages.lock.json index 545177e..3052241 100644 --- a/VSyntaxReader.Examples/packages.lock.json +++ b/VSyntaxReader.Examples/packages.lock.json @@ -2,11 +2,11 @@ "version": 1, "dependencies": { "net10.0": { - "Nerdbank.GitVersioning": { + "GitVersion.MsBuild": { "type": "Direct", - "requested": "[3.9.50, )", - "resolved": "3.9.50", - "contentHash": "HtOgGF6jZ+WYbXnCUCYPT8Y2d6mIJo9ozjK/FINTRsXdm4Zgv9GehUMa7EFoGQkqrMcDJNOIDwCmENnvXg4UbA==" + "requested": "[6.7.0, )", + "resolved": "6.7.0", + "contentHash": "0W5NHnfnogX0pfidRcJfqzfb8Yc/avBfq1qVuaHiHIjbtsjKHt9IFtt18p/ttCCeJlJe9fQliQ3pSkZQcibXlw==" }, "LinkDotNet.StringBuilder": { "type": "Transitive", diff --git a/VSyntaxReader.Tests/packages.lock.json b/VSyntaxReader.Tests/packages.lock.json index 3633fcc..6cd4373 100644 --- a/VSyntaxReader.Tests/packages.lock.json +++ b/VSyntaxReader.Tests/packages.lock.json @@ -8,6 +8,12 @@ "resolved": "10.0.0", "contentHash": "WFejCcOUR6k8UYyDnnR6Gk+obFYMsWrZuNqPJnsVFGVhpPSN0y20D4qbdKJnXinYGx9PQ397Hf9TnU1NBST8vA==" }, + "GitVersion.MsBuild": { + "type": "Direct", + "requested": "[6.7.0, )", + "resolved": "6.7.0", + "contentHash": "0W5NHnfnogX0pfidRcJfqzfb8Yc/avBfq1qVuaHiHIjbtsjKHt9IFtt18p/ttCCeJlJe9fQliQ3pSkZQcibXlw==" + }, "Microsoft.NET.Test.Sdk": { "type": "Direct", "requested": "[18.5.1, )", @@ -18,12 +24,6 @@ "Microsoft.TestPlatform.TestHost": "18.5.1" } }, - "Nerdbank.GitVersioning": { - "type": "Direct", - "requested": "[3.9.50, )", - "resolved": "3.9.50", - "contentHash": "HtOgGF6jZ+WYbXnCUCYPT8Y2d6mIJo9ozjK/FINTRsXdm4Zgv9GehUMa7EFoGQkqrMcDJNOIDwCmENnvXg4UbA==" - }, "xunit": { "type": "Direct", "requested": "[2.9.3, )", diff --git a/VSyntaxReader/packages.lock.json b/VSyntaxReader/packages.lock.json index 2869c93..e9c7a9e 100644 --- a/VSyntaxReader/packages.lock.json +++ b/VSyntaxReader/packages.lock.json @@ -2,6 +2,12 @@ "version": 1, "dependencies": { "net10.0": { + "GitVersion.MsBuild": { + "type": "Direct", + "requested": "[6.7.0, )", + "resolved": "6.7.0", + "contentHash": "0W5NHnfnogX0pfidRcJfqzfb8Yc/avBfq1qVuaHiHIjbtsjKHt9IFtt18p/ttCCeJlJe9fQliQ3pSkZQcibXlw==" + }, "LinkDotNet.StringBuilder": { "type": "Direct", "requested": "[3.4.1, )", @@ -14,12 +20,6 @@ "resolved": "10.0.7", "contentHash": "AA/yhzFHNtQZXLdqjzujPy25G8EWwGWsAnxOE2zYSBoT/8QHP6ketN3CToD3DFreO653ipUwnKHo22B8AlBMCw==" }, - "Nerdbank.GitVersioning": { - "type": "Direct", - "requested": "[3.9.50, )", - "resolved": "3.9.50", - "contentHash": "HtOgGF6jZ+WYbXnCUCYPT8Y2d6mIJo9ozjK/FINTRsXdm4Zgv9GehUMa7EFoGQkqrMcDJNOIDwCmENnvXg4UbA==" - }, "NodaTime": { "type": "Direct", "requested": "[3.3.2, )", @@ -37,6 +37,12 @@ } }, "net8.0": { + "GitVersion.MsBuild": { + "type": "Direct", + "requested": "[6.7.0, )", + "resolved": "6.7.0", + "contentHash": "0W5NHnfnogX0pfidRcJfqzfb8Yc/avBfq1qVuaHiHIjbtsjKHt9IFtt18p/ttCCeJlJe9fQliQ3pSkZQcibXlw==" + }, "LinkDotNet.StringBuilder": { "type": "Direct", "requested": "[3.4.1, )", @@ -49,12 +55,6 @@ "resolved": "8.0.26", "contentHash": "o7/yVssM2r9Wyln2s9edBd5ANZXqdSdBI+g7JqXkyJmXrhs2WsJp25K5yPnYrTgdKBCjKB8bg+O2oew4sgzFaA==" }, - "Nerdbank.GitVersioning": { - "type": "Direct", - "requested": "[3.9.50, )", - "resolved": "3.9.50", - "contentHash": "HtOgGF6jZ+WYbXnCUCYPT8Y2d6mIJo9ozjK/FINTRsXdm4Zgv9GehUMa7EFoGQkqrMcDJNOIDwCmENnvXg4UbA==" - }, "NodaTime": { "type": "Direct", "requested": "[3.3.2, )", @@ -72,6 +72,12 @@ } }, "net9.0": { + "GitVersion.MsBuild": { + "type": "Direct", + "requested": "[6.7.0, )", + "resolved": "6.7.0", + "contentHash": "0W5NHnfnogX0pfidRcJfqzfb8Yc/avBfq1qVuaHiHIjbtsjKHt9IFtt18p/ttCCeJlJe9fQliQ3pSkZQcibXlw==" + }, "LinkDotNet.StringBuilder": { "type": "Direct", "requested": "[3.4.1, )", @@ -84,12 +90,6 @@ "resolved": "9.0.15", "contentHash": "EejcbfCMR77Dthy77qxRbEShmzLApHZUPqXMBVQK+A0pNrRThkaHoGGMGvbq/gTkC/waKcDEgjBkbaejB58Wtw==" }, - "Nerdbank.GitVersioning": { - "type": "Direct", - "requested": "[3.9.50, )", - "resolved": "3.9.50", - "contentHash": "HtOgGF6jZ+WYbXnCUCYPT8Y2d6mIJo9ozjK/FINTRsXdm4Zgv9GehUMa7EFoGQkqrMcDJNOIDwCmENnvXg4UbA==" - }, "NodaTime": { "type": "Direct", "requested": "[3.3.2, )", diff --git a/version.json b/version.json deleted file mode 100644 index bf5f0cd..0000000 --- a/version.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "0.5-alpha.{height}", - "publicReleaseRefSpec": [ - "^refs/heads/main$", - "^refs/heads/release/v\\d+(?:\\.\\d+)?$" - ], - "cloudBuild": { - "setAllVariables": true, - "buildNumber": { - "enabled": true - } - }, - "release": { - "branchName": "release/v{version}" - } -} \ No newline at end of file