diff --git a/.github/workflows/gitversion.yml b/.github/workflows/gitversion.yml new file mode 100644 index 0000000..a081b63 --- /dev/null +++ b/.github/workflows/gitversion.yml @@ -0,0 +1,31 @@ +name: GitVersion validation + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + version: + name: Calculate semantic version + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - name: Install GitVersion + run: dotnet tool install GitVersion.Tool --tool-path "$RUNNER_TEMP/gitversion" --version 6.8.2 + - name: Calculate and validate version + shell: bash + run: | + set -euo pipefail + version="$("$RUNNER_TEMP/gitversion/dotnet-gitversion" /showvariable SemVer)" + test -n "$version" + echo "Calculated GitVersion SemVer: $version" + echo "### GitVersion: $version" >> "$GITHUB_STEP_SUMMARY" diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..54430ca --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,8 @@ +branches: + main: + increment: Patch + prevent-increment: + of-merged-branch: false +major-version-bump-message: '^(\w+)(\([^)]*\))?!:|BREAKING CHANGE:' +minor-version-bump-message: '^feat(\([^)]*\))?:' +patch-version-bump-message: '^(fix|perf)(\([^)]*\))?:'