diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml
deleted file mode 100644
index f9bf7b7d..00000000
--- a/.github/workflows/create-release.yml
+++ /dev/null
@@ -1,90 +0,0 @@
-name: Prepare Release & Publish Package
-
-on:
- workflow_dispatch:
- inputs:
- target_branch:
- description: "Branch or tag to release from"
- type: choice
- options: [ main, master, develop ]
- default: main
- required: true
- increment:
- description: "Version bump"
- type: choice
- options: [ major, minor, patch ]
- default: patch
- required: true
-
-permissions:
- contents: write
- pull-requests: write
- packages: write
-
-jobs:
- validate_branch:
- runs-on: ubuntu-latest
-
-
- outputs:
- version_json_path: ${{ steps.locate_version.outputs.file }}
-
- steps:
- - name: Checkout target branch
- uses: actions/checkout@v4
- with:
- fetch-depth: 1
- ref: ${{ inputs.target_branch }}
-
- # Optional sanity check (keeps the job obvious when the ref is wrong)
- - name: Ensure target branch exists
- run: |
- if ! git rev-parse --verify --quiet "refs/heads/${{ inputs.target_branch }}"; then
- echo "::error::Ref '${{ inputs.target_branch }}' not found."
- exit 1
- fi
-
- # Find version.json and emit its absolute path
- - name: Locate version.json
- id: locate_version
- shell: bash
- run: |
- # Search Git-tracked files first …
- REL_PATH=$(git ls-files --full-name '*version.json' | head -n1)
-
- # … fall back to a filesystem search for untracked files (optional)
- if [[ -z "$REL_PATH" ]]; then
- REL_PATH=$(find . -type f -name version.json | head -n1 | sed 's|^\./||')
- fi
-
- if [[ -z "$REL_PATH" ]]; then
- echo "::error::version.json not found on branch '${{ inputs.target_branch }}'."
- tree -L 2 -C || true
- exit 1
- fi
-
- ABS_PATH="$GITHUB_WORKSPACE/$REL_PATH"
- echo "Found version.json at: $ABS_PATH"
-
- # Pass the path to other jobs
- echo "file=$ABS_PATH" >> "$GITHUB_OUTPUT"
-
- prepare:
- needs: validate_branch
- uses: Stillpoint-Software/shared-workflows/.github/workflows/nbgv_prepare_release.yml@main
- with:
- target_branch: ${{ inputs.target_branch }}
- increment: ${{ inputs.increment }}
- version_file_path: ${{ needs.validate_branch.outputs.version_json_path }}
- secrets: inherit
-
- publish:
- needs: prepare
- uses: Stillpoint-Software/shared-workflows/.github/workflows/nbgv_dotnet_pack.yml@main
- with:
- checkout_ref: ${{ needs.prepare.outputs.release_branch }}
- build_configuration: ${{ inputs.target_branch == 'develop' && 'Develop' || 'Release' }}
- push_after_pack: true
- force_dev_prerelease: ${{ inputs.target_branch == 'develop' }}
- secrets:
- NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml
new file mode 100644
index 00000000..ec7c0afe
--- /dev/null
+++ b/.github/workflows/create_release.yml
@@ -0,0 +1,74 @@
+name: Create Release
+
+on:
+ workflow_dispatch:
+ inputs:
+ mode:
+ description: |
+ How to set the version:
+ - explicit: set to a specific value (e.g., 1.3-alpha)
+ - bump: bump major/minor/patch from current SimpleVersion and apply optional prerelease
+ - auto: policy-based (develop->next minor -alpha; hotfix/*->next patch -alpha; main/vX.Y->stable)
+ type: choice
+ options: [auto, bump, explicit]
+ default: auto
+ version:
+ description: "When mode=explicit: exact version (e.g., 1.3-alpha, 1.2.3, 1.4.0-rc)"
+ type: string
+ default: ""
+ increment:
+ description: "When mode=bump: major | minor | patch"
+ type: choice
+ options: [major, minor, patch]
+ default: patch
+ prerelease:
+ description: "When mode=bump: prerelease suffix WITHOUT leading dash (e.g., alpha, beta, rc). Leave blank for stable."
+ type: string
+ default: ""
+
+permissions:
+ contents: write
+ pull-requests: write
+ packages: write
+
+run-name: "Create Release · ${{ inputs.mode }} · ${{ github.ref_name }}"
+
+jobs:
+ validate-inputs:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check conditional requirements
+ run: |
+ set -euo pipefail
+ MODE='${{ inputs.mode }}'
+ VERSION='${{ inputs.version }}'
+ INCR='${{ inputs.increment }}'
+ if [[ "$MODE" == "explicit" && -z "$VERSION" ]]; then
+ echo "❌ mode=explicit requires 'version' (e.g., 1.3-alpha)."; exit 1
+ fi
+ if [[ "$MODE" == "bump" && -z "$INCR" ]]; then
+ echo "❌ mode=bump requires 'increment' (major|minor|patch)."; exit 1
+ fi
+ echo "✅ inputs look good."
+
+ set-version:
+ needs: validate-inputs
+ uses: Stillpoint-Software/shared-workflows/.github/workflows/set_version.yml@main
+ with:
+ target_branch: ${{ github.ref_name }}
+ mode: ${{ inputs.mode }}
+ version: ${{ inputs.version }}
+ increment: ${{ inputs.increment }}
+ prerelease: ${{ inputs.prerelease }}
+ secrets: inherit
+
+ create-release:
+ needs: set-version
+ uses: Stillpoint-Software/shared-workflows/.github/workflows/prepare_release.yml@main
+ with:
+ target_branch: ${{ github.ref_name }}
+ tag: ${{ needs.set-version.outputs.tag }}
+ prerelease: ${{ needs.set-version.outputs.new_prerelease }}
+ draft: true
+ secrets:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/create_test_report.yml b/.github/workflows/create_test_report.yml
new file mode 100644
index 00000000..80c58fb4
--- /dev/null
+++ b/.github/workflows/create_test_report.yml
@@ -0,0 +1,39 @@
+name: Create Test Report
+
+on:
+ workflow_run:
+ workflows: ["Run Tests"]
+ types: [completed]
+ branches: [main, develop]
+
+permissions:
+ contents: read
+ actions: read
+ checks: write
+
+jobs:
+ discover-auto:
+ runs-on: ubuntu-latest
+ if: ${{ github.event_name == 'workflow_run' }}
+ outputs:
+ branch_name: ${{ steps.meta.outputs.branch }}
+ sha: ${{ steps.meta.outputs.sha }}
+ run_id: ${{ steps.meta.outputs.run_id }}
+ conclusion: ${{ steps.meta.outputs.conclusion }}
+ steps:
+ - id: meta
+ run: |
+ echo "branch=${{ github.event.workflow_run.head_branch }}" >> "$GITHUB_OUTPUT"
+ echo "sha=${{ github.event.workflow_run.head_sha }}" >> "$GITHUB_OUTPUT"
+ echo "run_id=${{ github.event.workflow_run.id }}" >> "$GITHUB_OUTPUT"
+ echo "conclusion=${{ github.event.workflow_run.conclusion }}" >> "$GITHUB_OUTPUT"
+
+ report-auto:
+ needs: discover-auto
+ if: ${{ needs.discover-auto.outputs.conclusion != 'skipped' }}
+ uses: Stillpoint-Software/shared-workflows/.github/workflows/test_report.yml@main
+ with:
+ test_run_id: ${{ needs.discover-auto.outputs.run_id }}
+ branch: ${{ needs.discover-auto.outputs.branch_name }}
+ sha: ${{ needs.discover-auto.outputs.sha }}
+ secrets: inherit
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
index 04778d31..3adcfc23 100644
--- a/.github/workflows/format.yml
+++ b/.github/workflows/format.yml
@@ -1,29 +1,52 @@
name: Format
-on:
+on:
push:
- workflow_run:
- workflows:
- - Create Prerelease
- - Create Release
- types: [requested]
workflow_dispatch:
pull_request:
types: [opened, edited, synchronize, reopened]
- branches:
- - main
- - develop
+ branches: [main, develop]
+ workflow_run:
+ workflows: [Create Prerelease, Create Release]
+ types: [requested]
+
permissions:
- contents: read
+ contents: write
+ pull-requests: write
+ actions: read
jobs:
- format:
- uses: Stillpoint-Software/shared-workflows/.github/workflows/format.yml@main
- with:
- dotnet_version: "9.0.x"
- secrets:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
+ discover:
+ runs-on: ubuntu-latest
+ outputs:
+ branch_name: ${{ steps.set_branch.outputs.branch_name }}
+ steps:
+ - id: set_branch
+ shell: bash
+ run: |
+ # 1. Pick the raw branch/ref for each trigger type
+ if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
+ RAW='${{ github.event.workflow_run.head_branch }}'
+ elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
+ RAW='${{ github.event.pull_request.base.ref }}'
+ else
+ RAW='${{ github.ref }}'
+ fi
+ # 2. Strip the refs/heads/ prefix if present
+ CLEAN="${RAW#refs/heads/}"
+ echo "Detected branch: $CLEAN"
+ echo "branch_name=$CLEAN" >> "$GITHUB_OUTPUT"
+
+ format:
+ needs: discover
+ if: ${{ needs.discover.result == 'success' }}
+ uses: Stillpoint-Software/shared-workflows/.github/workflows/format.yml@main
+ with:
+ dotnet_version: "9.0.x"
+ branch: ${{ needs.discover.outputs.branch_name }}
+ secrets: inherit
+
diff --git a/.github/workflows/issue-branch.yml b/.github/workflows/issue-branch.yml
deleted file mode 100644
index 7638f377..00000000
--- a/.github/workflows/issue-branch.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-name: Create Issue Branch
-
-on:
- # The issue.opened event below is only needed for the "immediate" mode.
- # The issue.assigned event below is only needed for the default ("auto") mode.
- issues:
- types: [ opened, assigned ]
- # The issue_comment.created event below is only needed for the ChatOps mode.
- issue_comment:
- types: [ created ]
- # The pull_request events below are only needed for pull-request related features.
- pull_request:
- types: [ opened, closed ]
-
-permissions:
- contents: read
- issues: write
- pull-requests: write
-
-jobs:
- create_issue_branch_job:
- uses: Stillpoint-Software/shared-workflows/.github/workflows/create-issue-branch.yml@main
- secrets:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/issue_branch.yml b/.github/workflows/issue_branch.yml
new file mode 100644
index 00000000..0206d733
--- /dev/null
+++ b/.github/workflows/issue_branch.yml
@@ -0,0 +1,35 @@
+name: Create Issue Branch
+
+on:
+ issues:
+ types: [opened, assigned]
+ issue_comment:
+ types: [created]
+ pull_request:
+ types: [opened, closed]
+
+permissions:
+ contents: read
+ issues: write
+ pull-requests: write
+
+jobs:
+ discover:
+ runs-on: ubuntu-latest
+ outputs:
+ branch_name: ${{ steps.set_branch.outputs.branch_name }}
+ steps:
+ - name: Determine target branch
+ id: set_branch
+ run: echo "branch_name=${BRANCH}" >> "$GITHUB_OUTPUT"
+ env:
+ BRANCH: >-
+ ${{ github.event_name == 'pull_request' &&
+ github.event.pull_request.base.ref ||
+ 'main' }}
+
+ create-issue-branch-main:
+ needs: discover
+ if: ${{ needs.discover.result == 'success' }}
+ uses: Stillpoint-Software/shared-workflows/.github/workflows/issue_branch.yml@main
+ secrets: inherit
diff --git a/.github/workflows/pack_publish.yml b/.github/workflows/pack_publish.yml
new file mode 100644
index 00000000..fcc21837
--- /dev/null
+++ b/.github/workflows/pack_publish.yml
@@ -0,0 +1,27 @@
+name: Pack and Publish
+
+on:
+ release:
+ types: [published]
+
+permissions:
+ contents: write
+ pull-requests: write
+ packages: write
+
+jobs:
+ set-config:
+ uses: Stillpoint-Software/shared-workflows/.github/workflows/determine_build_configuration.yml@main
+ with:
+ trigger: release
+ target_branch: ${{ github.event.release.target_commitish }}
+ override_build_configuration: ''
+ prerelease: ${{ github.event.release.prerelease }} # true/false from the release
+
+ publish:
+ needs: set-config
+ uses: Stillpoint-Software/shared-workflows/.github/workflows/pack_and_publish.yml@main
+ with:
+ build_configuration: ${{ needs.set-config.outputs.build_configuration }}
+ secrets:
+ NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml
new file mode 100644
index 00000000..9efc51db
--- /dev/null
+++ b/.github/workflows/run_tests.yml
@@ -0,0 +1,48 @@
+name: Run Tests
+
+on:
+ workflow_run:
+ workflows: [Create Prerelease, Create Release]
+ types: [requested]
+ branches: [main, develop]
+ workflow_dispatch:
+ pull_request:
+ types: [opened, edited, synchronize, reopened]
+ branches: [main, develop]
+
+permissions:
+ contents: read
+ actions: read
+
+jobs:
+ discover:
+ runs-on: ubuntu-latest
+ outputs:
+ branch_name: ${{ steps.set_branch.outputs.branch_name }}
+
+ steps:
+ - id: set_branch
+ shell: bash
+ run: |
+ # 1. Pick the raw branch/ref for each trigger type
+ if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
+ RAW='${{ github.event.workflow_run.head_branch }}'
+ elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
+ RAW='${{ github.event.pull_request.base.ref }}'
+ else
+ RAW='${{ github.ref }}'
+ fi
+
+ # 2. Strip the refs/heads/ prefix if present
+ CLEAN="${RAW#refs/heads/}"
+
+ echo "Detected branch: $CLEAN"
+ echo "branch_name=$CLEAN" >> "$GITHUB_OUTPUT"
+
+ test:
+ needs: discover
+ uses: Stillpoint-Software/shared-workflows/.github/workflows/run_tests.yml@main
+ with:
+ branch: ${{ needs.discover.outputs.branch_name }}
+ solution_name: ${{ vars.SOLUTION_NAME }}
+ secrets: inherit
diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml
deleted file mode 100644
index f465967e..00000000
--- a/.github/workflows/test-report.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: Test Report
-run-name: Generate Test Report for workflow ${{ github.event.workflow_run.name }} run ${{ github.event.workflow_run.run_number }} branch ${{ github.event.workflow_run.head_branch }}
-
-on:
- workflow_run:
- workflows: [ "Test" ]
- types:
- - completed
-
-permissions:
- contents: read
- actions: read
- checks: write
-
-jobs:
- report:
- uses: Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@main
- with:
- artifact_name: "test-results"
- test_report_name: "Unit Tests"
- path: "*.trx"
\ No newline at end of file
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
deleted file mode 100644
index 6f771142..00000000
--- a/.github/workflows/test.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: Test
-
-on:
- workflow_run:
- workflows:
- - Create Prerelease
- - Create Release
- types: [requested]
- workflow_dispatch:
- pull_request:
- types: [opened, edited, synchronize, reopened]
- branches:
- - main
- - develop
-
-permissions:
- contents: read
-
-jobs:
- test:
- uses: Stillpoint-Software/shared-workflows/.github/workflows/test.yml@main
- with:
- dotnet_version: "9.0.x"
- solution_name: ${{ vars.SOLUTION_NAME }}
- secrets:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
-
diff --git a/.github/workflows/unlist_package.yml b/.github/workflows/unlist_package.yml
new file mode 100644
index 00000000..ed2c1d66
--- /dev/null
+++ b/.github/workflows/unlist_package.yml
@@ -0,0 +1,32 @@
+name: Unlist NuGet Package
+
+on:
+ workflow_dispatch:
+ inputs:
+ package_id:
+ description: "NuGet package ID (e.g., Hyperbee.xxx)"
+ required: true
+ type: string
+ package_version:
+ description: "Exact version (e.g., v1.2.1-alpha-ge4caaff67a)"
+ required: true
+ type: string
+ dry_run:
+ description: "If true, shows what would happen"
+ required: false
+ default: false
+ type: boolean
+
+permissions:
+ contents: read
+
+run-name: "Unlist ${{ inputs.package_id }} ${{ inputs.package_nuget }}"
+
+jobs:
+ unlist:
+ uses: Stillpoint-Software/shared-workflows/.github/workflows/unlist-package.yml@main
+ secrets: inherit
+ with:
+ package_id: ${{ inputs.package_id }}
+ package_version: ${{ inputs.package_version }}
+ dry_run: ${{ inputs.dry_run }}
diff --git a/Directory.Build.props b/Directory.Build.props
index 10903eb4..2256d66a 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,14 +1,48 @@
+
+
-
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
- Release;Develop
true
- true
+ true
true
- embedded
+ true
-
\ No newline at end of file
+
+
+
+ README.md
+ LICENSE
+ true
+ assets/icon.png
+ https://github.com/Stillpoint-Software/Hyperbee.Expressions/releases/latest
+ https://github.com/Stillpoint-Software/Hyperbee.Expressions
+ git
+ https://github.com/Stillpoint-Software/Hyperbee.Expressions
+
+
+
+
+
+
+
+
+
diff --git a/Directory.Build.targets b/Directory.Build.targets
deleted file mode 100644
index 32316029..00000000
--- a/Directory.Build.targets
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- $(GitBuildVersionSimple)-develop
-
-
-
-
- true
-
-
\ No newline at end of file
diff --git a/Hyperbee.Expressions.sln b/Hyperbee.Expressions.sln
index b01579d3..ae8425db 100644
--- a/Hyperbee.Expressions.sln
+++ b/Hyperbee.Expressions.sln
@@ -6,7 +6,8 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6103145C-EC79-4B5F-9CE6-8F10BFC6ACC5}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
- Directory.Build.targets = Directory.Build.targets
+ LICENSE = LICENSE
+ README.md = README.md
version.json = version.json
EndProjectSection
EndProject
@@ -18,12 +19,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{23A5
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{639ADCDD-E258-40E6-BBC3-70D71DE97191}"
ProjectSection(SolutionItems) = preProject
- .github\workflows\create-release.yml = .github\workflows\create-release.yml
+ .github\workflows\create_release.yml = .github\workflows\create_release.yml
+ .github\workflows\create_test_report.yml = .github\workflows\create_test_report.yml
.github\workflows\deploy-gh-pages.yml = .github\workflows\deploy-gh-pages.yml
.github\workflows\format.yml = .github\workflows\format.yml
- .github\workflows\issue-branch.yml = .github\workflows\issue-branch.yml
- .github\workflows\test-report.yml = .github\workflows\test-report.yml
- .github\workflows\test.yml = .github\workflows\test.yml
+ .github\workflows\issue_branch.yml = .github\workflows\issue_branch.yml
+ .github\workflows\pack_publish.yml = .github\workflows\pack_publish.yml
+ .github\workflows\run_tests.yml = .github\workflows\run_tests.yml
+ .github\workflows\unlist_package.yml = .github\workflows\unlist_package.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Tests", "Solution Tests", "{FCA0C3C6-AA4C-4EB8-869B-9B12913518FF}"
diff --git a/README.md b/README.md
index 9526fac2..7714d783 100644
--- a/README.md
+++ b/README.md
@@ -167,4 +167,5 @@ Special thanks to:
## Contributing
We welcome contributions! Please see our [Contributing Guide](https://github.com/Stillpoint-Software/.github/blob/main/.github/CONTRIBUTING.md)
-for more detai
\ No newline at end of file
+for more details
+
diff --git a/solution-helper.psm1 b/solution-helper.psm1
deleted file mode 100644
index f59e7290..00000000
--- a/solution-helper.psm1
+++ /dev/null
@@ -1,213 +0,0 @@
-<#
- .SYNOPSIS
- Solution helpers.
-
- .DESCRIPTION
- Commands for managing nugets.
- These methods may be executed from the `Developer PowerShell` terminal window.
- Import-Module ./solution-helper
-#>
-
-function Publish-Packages() {
- Param(
- [Parameter(Position = 0)]
- [Alias("c")]
- [string] $Configuration = 'Debug',
-
- [Alias("t")]
- [string] $Tag = 'local'
- )
-
- try {
- $Tag = ($Tag -replace '\s+', '').ToLower()
- Write-Host "Building and publishing packages for '$Configuration' with tag '$Tag'."
-
- $timestamp = [System.DateTime]::UtcNow.ToString( 'yyMMddHHmmss' )
-
- if ( !$Tag ) {
- Write-Error "Non-semver publication is not supported."
- throw
- }
-
- dotnet pack --no-build --configuration $Configuration --output ./output --version-suffix "$Tag.$timestamp" -p:PushAfterPack=true
- }
- catch {
- Write-Error "Publish-Packages failed. Make sure you are executing from a `Developer PowerShell` session."
- }
-}
-
-function Resize-Feed() {
- Param(
- [string] $Name = '*',
- [int] $Keep = 5,
- [string] $Source = 'local'
- )
-
- Write-Host "Collecting package versions from $source ..."
-
- # get unique packages
- $packages = Find-Package $Name -source $Source
-
- foreach( $package in $packages ) {
- $packageName = $package.Name
-
- # get all versions for this package
-
- $sortExpr = { param($version) # convert '1.2.3-..' to '00001-00002-00003-..'
- $parts = $version.Split('-')
- $key = ( $parts[0].Split('.') | ForEach-Object { $_.PadLeft(5,'0') } ) -join '-'
- $key,$parts[1] -join '-'
- }
-
- $versions = Find-Package $packageName -source $source -allversions | Sort-Object { &$sortExpr -version $_.Version } -Descending
-
- Write-Host "Found '$packageName'. $($versions.Count) Packages."
-
- if ( $versions.Count -gt $Keep ) {
- $removeCount = $versions.Count - $Keep
- Write-Host "$removeCount Packages will be removed."
-
- foreach( $p in ($versions | Select-Object -Skip $Keep ) ) {
- dotnet nuget delete $p.Name $p.Version --source $Source --non-interactive
- }
- }
- }
-}
-
-function Update-Version() {
- Param(
- [Parameter(Position = 0, Mandatory=$true)]
- [ValidateSet('Major','Minor','Patch', IgnoreCase = $true)]
- [string] $Type,
- [string] $Path = 'Directory.Build.props',
- [switch] $Commit
- )
-
- try {
- if (!(Test-Path $Path)) {
- Write-Error "The version file '$Path' was not found in the current directory."
- throw
- }
-
- $Type = (Get-Culture).TextInfo.ToTitleCase($Type) # e.g. convert 'major' to 'Major'
- $propName = $Type + "Version"
-
- $xml = [xml](Get-Content $Path)
- $ns = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
- $ns.AddNamespace("ns", $xml.DocumentElement.NamespaceURI)
-
- $node = $xml.SelectSingleNode("//ns:Project/ns:PropertyGroup[ns:$propName]", $ns)
- $version = $node.$propName -as [Int]
-
- $previousVersionString = "v$($node.MajorVersion).$($node.MinorVersion).$($node.PatchVersion)"
-
- $node.$propName = ($version + 1) -as [String]
-
- if ( $Type -eq 'major' ) {
- $node.MinorVersion = '0'
- $node.PatchVersion = '0'
- }
-
- if ( $Type -eq 'minor' ) {
- $node.PatchVersion = '0'
- }
-
- $newVersionString = "v$($node.MajorVersion).$($node.MinorVersion).$($node.PatchVersion)"
- Write-Host "Previous version was '$previousVersionString'. Version now '$newVersionString'."
-
- $xml.Save($Path)
-
- if ( $Commit ) {
- git add $Path
- git commit -m "bump $($Type.ToLower())" -q -o $Path
- }
-
- return $previousVersionString, $newVersionString
- }
- catch {
- Write-Error "Update-Version failed. Make sure you are executing from a `Developer PowerShell`."
- }
-}
-
-function Set-Version() {
- Param(
- [Parameter(Position = 0,Mandatory=$true)]
- [string] $Version,
- [string] $Path = 'Directory.Build.props',
- [switch] $Commit
- )
-
- try {
- if (!(Test-Path $Path)) {
- Write-Error "The version file '$Path' was not found in the current directory."
- throw
- }
-
- # Remove any non-numeric characters from the version string
- $Version = $Version -replace '[^0-9.]', ''
-
- # Split the version string into major, minor, and patch versions
- $MajorVersion, $MinorVersion, $PatchVersion = $Version.Split('.')
-
- $xml = [xml](Get-Content $Path)
- $ns = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
- $ns.AddNamespace("ns", $xml.DocumentElement.NamespaceURI)
-
- $node = $xml.SelectSingleNode("//ns:Project/ns:PropertyGroup", $ns)
-
- $previousVersionString = "v$($node.MajorVersion).$($node.MinorVersion).$($node.PatchVersion)"
-
- # Update the version numbers
- $node.MajorVersion = $MajorVersion
- $node.MinorVersion = $MinorVersion
- $node.PatchVersion = $PatchVersion
-
- $newVersionString = "v$($node.MajorVersion).$($node.MinorVersion).$($node.PatchVersion)"
- Write-Host "Previous version was '$previousVersionString'. Version now '$newVersionString'."
-
- $xml.Save($Path)
-
- if ( $Commit ) {
- git add $Path
- git commit -m "bump $($Type.ToLower())" -q -o $Path
- }
-
- return $previousVersionString, $newVersionString
- }
- catch {
- Write-Error "Set-Version failed. Make sure you are executing from a `Developer PowerShell`."
- }
-}
-
-function Get-Version() {
- Param(
- [string] $Path = 'Directory.Build.props'
- )
-
- try {
- if (!(Test-Path $Path)) {
- Write-Error "The version file '$Path' was not found in the current directory."
- throw
- }
-
- $xml = [xml](Get-Content $Path)
- $ns = New-Object System.Xml.XmlNamespaceManager($xml.NameTable)
- $ns.AddNamespace("ns", $xml.DocumentElement.NamespaceURI)
-
- $node = $xml.SelectSingleNode("//ns:Project/ns:PropertyGroup", $ns)
-
- $versionString = "v$($node.MajorVersion).$($node.MinorVersion).$($node.PatchVersion)"
- Write-Host "Current version is '$versionString'."
-
- return $versionString
- }
- catch {
- Write-Error "Get-Version failed. Make sure you are executing from a `Developer PowerShell`."
- }
-}
-
-Export-ModuleMember -Function 'Publish-Packages'
-Export-ModuleMember -Function 'Resize-Feed'
-Export-ModuleMember -Function 'Update-Version'
-Export-ModuleMember -Function 'Set-Version'
-Export-ModuleMember -Function 'Get-Version'
\ No newline at end of file
diff --git a/version.json b/version.json
index 18293eec..3b53b394 100644
--- a/version.json
+++ b/version.json
@@ -1,14 +1,9 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.2.0",
- "prereleaseTemplates": {
- "tag": "develop"
- },
- "assemblyVersion": {
- "precision": "revision"
- },
"publicReleaseRefSpec": [
"^refs/heads/main$",
- "^refs/heads/release\\/.+$"
+ "^refs/heads/hotfix$",
+ "^refs/heads/v\\d+\\.\\d+$"
]
}
\ No newline at end of file