diff --git a/.github/workflows/Format.yml b/.github/workflows/Format.yml
index 923052d..3adcfc2 100644
--- a/.github/workflows/Format.yml
+++ b/.github/workflows/Format.yml
@@ -1,46 +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
+ types: [opened, edited, synchronize, reopened]
+ branches: [main, develop]
+ workflow_run:
+ workflows: [Create Prerelease, Create Release]
+ types: [requested]
+
permissions:
- contents: write
-
-env:
- DOTNET_VERSION: "9.0.x"
+ contents: write
+ pull-requests: write
+ actions: read
jobs:
- format:
+ discover:
runs-on: ubuntu-latest
+ outputs:
+ branch_name: ${{ steps.set_branch.outputs.branch_name }}
steps:
- - name: Checkout Code
- uses: actions/checkout@v4
-
- - name: Setup .NET
- uses: actions/setup-dotnet@v4
- with:
- dotnet-version: ${{ env.DOTNET_VERSION }}
-
- - name: Format
- run: dotnet format
-
- - name: Update Styles
- continue-on-error: true
- run: |
- git config --global user.name 'github-actions'
- git config --global user.email 'github-actions@github.com'
- git commit -am "Updated code formatting to match rules in .editorconfig"
- git push
-
+ - 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/Publish.yml b/.github/workflows/Publish.yml
deleted file mode 100644
index 91a13e5..0000000
--- a/.github/workflows/Publish.yml
+++ /dev/null
@@ -1,89 +0,0 @@
-name: Publish
-
-on:
- workflow_dispatch:
- release:
- types: [published]
-
-env:
- BRANCH_NAME: ${{ github.event.release.target_commitish }}
- SOLUTION_NAME: ${{ vars.SOLUTION_NAME }}
- PROJECT_NAME: ${{ vars.PROJECT_NAME }}
- DOTNET_VERSION: '9.0.x'
- NUGET_SOURCE: 'https://api.nuget.org/v3/index.json'
- BUILD_CONFIGURATION: ''
- VERSION_SUFFIX: ''
-
-permissions:
- contents: write
- packages: write
- actions: read
-
-jobs:
- build-publish:
- runs-on: ubuntu-latest
-
- steps:
- - name: Release Configuration
- if: ${{ env.BRANCH_NAME == 'main' && (github.event.release.prerelease == false || github.event_name == 'workflow_dispatch') }}
- run: |
- echo "BUILD_CONFIGURATION=Release" >> $GITHUB_ENV
-
- - name: Debug Configuration
- if: ${{ (github.event.release.prerelease || github.event_name == 'workflow_dispatch') }}
- run: |
- echo "BUILD_CONFIGURATION=Debug" >> $GITHUB_ENV
-
- - name: Check Build Configuration
- if: ${{ env.BUILD_CONFIGURATION == '' }}
- run: |
- echo "Invalid Build Configuration"
- exit 1
-
- - name: Checkout Code
- uses: actions/checkout@v4
-
- - name: Get Current Version
- id: get_version
- shell: pwsh
- run: |
- Import-Module ./solution-helper.psm1 -Force
- $build_version = Get-Version
- echo "build_version=$build_version" | Out-File -FilePath $env:GITHUB_ENV -Append
-
- - name: Get Version Suffix
- id: get_version_suffix
- shell: bash
- run: |
- # Fetch the list of releases
- releases=$(gh release list --json createdAt,tagName --limit 100)
-
- # Filter the releases based on the starting version number, sort them by date, and extract the most recent one
- latest_release=$(echo "$releases" | jq -r --arg build_version "$build_version" 'map(select(.tagName | startswith($build_version))) | sort_by(.createdAt) | reverse | .[0] | .tagName')
-
- version_suffix=${latest_release#*$build_version-}
-
- if [ "$version_suffix" == "$build_version" ]; then
- version_suffix=""
- fi
-
- echo "VERSION_SUFFIX=$version_suffix" >> $GITHUB_ENV
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Setup .NET
- uses: actions/setup-dotnet@v4
- with:
- dotnet-version: ${{ env.DOTNET_VERSION }}
-
- - name: Restore Dependencies
- run: dotnet restore ${{ env.SOLUTION_NAME }}
-
- - name: Build
- run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIGURATION }} ${{ env.SOLUTION_NAME }}
-
- - name: Test
- run: dotnet test --no-build --verbosity normal --configuration ${{ env.BUILD_CONFIGURATION }} ${{ env.SOLUTION_NAME }}
-
- - name: Pack and Push
- run: dotnet pack --no-build --configuration ${{ env.BUILD_CONFIGURATION }} -p:PackageId=${{ env.PROJECT_NAME }} -p:PackageOutputPath=../../output --version-suffix "${{ env.VERSION_SUFFIX }}" -p:PackageSource='${{ env.NUGET_SOURCE }}' -p:PushAfterPack=true -p:PackageApiKey='${{ secrets.NUGET_API_KEY }}'
diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml
deleted file mode 100644
index 70308e4..0000000
--- a/.github/workflows/Test.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-name: Test
-
-on:
- workflow_run:
- workflows:
- - Create Prerelease
- - Create Release
- # - Publish
- types: [requested]
- workflow_dispatch:
- pull_request:
- types: [opened,edited,synchronize,reopened]
- branches:
- - main
- - develop
-
-permissions:
- contents: read
- actions: read
-
-env:
- BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
- SOLUTION_NAME: ${{ vars.SOLUTION_NAME }}
- DOTNET_VERSION: "9.0.x"
-
-jobs:
- test:
- runs-on: ubuntu-latest
-
- steps:
- - name: Release Configuration
- if: ${{ env.BRANCH_NAME == 'main' }}
- run: |
- echo "BUILD_CONFIGURATION=Release" >> $GITHUB_ENV
-
- - name: Debug Configuration
- if: ${{ env.BRANCH_NAME != 'main' }}
- run: |
- echo "BUILD_CONFIGURATION=Debug" >> $GITHUB_ENV
-
- - name: Checkout Code
- uses: actions/checkout@v4
-
- - name: Setup .NET
- uses: actions/setup-dotnet@v4
- with:
- dotnet-version: ${{ env.DOTNET_VERSION }}
-
- - name: Restore Dependencies
- run: dotnet restore ${{ env.SOLUTION_NAME }}
-
- - name: Build
- run: dotnet build --no-restore --configuration ${{ env.BUILD_CONFIGURATION }} ${{ env.SOLUTION_NAME }}
-
- - name: Tests
- run: |
- dotnet test --no-build --configuration ${{ env.BUILD_CONFIGURATION }} --logger:trx --results-directory:./TestResults ${{ env.SOLUTION_NAME }}
-
- - name: Upload Test Results
- uses: actions/upload-artifact@v3 # upload test results
- if: success() || failure() # run this step even if previous step failed
- with:
- name: test-results
- path: ./TestResults/**/*.trx
-
diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml
deleted file mode 100644
index 24ce931..0000000
--- a/.github/workflows/create-release.yml
+++ /dev/null
@@ -1,61 +0,0 @@
-name: Create Release
-
-on:
- workflow_dispatch:
- inputs:
- is_prerelease:
- description: 'Create a prerelease:'
- type: boolean
- required: true
- default: false
- is_draft:
- description: 'Set as a draft:'
- type: boolean
- required: true
- default: false
-
-permissions:
- contents: write
-
-env:
- ALLOW_PRERELEASE: ${{ startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/hotfix/') }}
-
-jobs:
- create-release:
- runs-on: ubuntu-latest
-
- steps:
- - name: Check For Valid Prerelease
- if: ${{ ( env.ALLOW_PRERELEASE == 'true' && github.event.inputs.is_prerelease == 'false' ) || ( github.ref == 'refs/heads/main' && github.event.inputs.is_prerelease == 'true' ) }}
- run: |
- echo "Prereleases should not be triggered on the main branch, please use development or hotfix"
- exit 1
-
- - name: Checkout Code
- uses: actions/checkout@v4
-
- - name: Get Current Version
- id: get_version
- shell: pwsh
- run: |
- Import-Module ./solution-helper.psm1 -Force
- $version = Get-Version
- if ("${{ github.event.inputs.is_prerelease }}" -eq "true") {
- $version_tag = "$version-develop.$(date +'%y%m%d%H%M%S')"
- } else {
- $version_tag = $version
- }
- echo "version_tag=$version_tag" | Out-File -FilePath $env:GITHUB_ENV -Append
-
- - name: Create Release
- run: |
- echo "🎁 Creating release ${{ env.version_tag }}"
- gh release create ${{ env.version_tag }} \
- --target ${{ github.ref_name }} \
- --title ${{ env.version_tag }} \
- --generate-notes \
- $(if [[ "${{ github.event.inputs.is_draft }}" == "true" ]]; then echo "--draft"; fi) \
- $(if [[ "${{ github.event.inputs.is_prerelease }}" == "true" ]]; then echo "--prerelease"; fi) \
- $(if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then echo "--latest"; fi)
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml
new file mode 100644
index 0000000..ec7c0af
--- /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 0000000..80c58fb
--- /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/issue-branch.yml b/.github/workflows/issue-branch.yml
deleted file mode 100644
index 4b0816c..0000000
--- a/.github/workflows/issue-branch.yml
+++ /dev/null
@@ -1,28 +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: write
- issues: write
- pull-requests: write
-
-jobs:
- create_issue_branch_job:
- runs-on: ubuntu-latest
- steps:
- - name: Create Issue Branch
- id: Create_Issue_Branch
- uses: robvanderleek/create-issue-branch@main
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/issue_branch.yml b/.github/workflows/issue_branch.yml
new file mode 100644
index 0000000..6a49fbc
--- /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 0000000..da79cee
--- /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 0000000..9efc51d
--- /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 20dc477..0000000
--- a/.github/workflows/test-report.yml
+++ /dev/null
@@ -1,29 +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 }}
-
-# https://github.com/dorny/test-reporter#recommended-setup-for-public-repositories
-# This workflow is for test report
-
-on:
- workflow_run:
- workflows: [ "Test" ]
- types:
- - completed
-
-permissions:
- contents: read
- actions: read
- checks: write
-
-jobs:
- report:
- runs-on: ubuntu-latest
- steps:
- - name: Test Report 🧪
- uses: dorny/test-reporter@v1
- with:
- artifact: test-results
- name: Unit Tests
- path: "*.trx"
- reporter: dotnet-trx
- fail-on-error: false
\ No newline at end of file
diff --git a/.github/workflows/unlist-nuget.yml b/.github/workflows/unlist-nuget.yml
deleted file mode 100644
index 98fa59d..0000000
--- a/.github/workflows/unlist-nuget.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-name: Unlist NuGet
-
-on:
- workflow_dispatch:
- # release:
- # types: [deleted]
-
-permissions:
- contents: write
-
-env:
- BRANCH_NAME: ${{ github.event.release.target_commitish }}
- PROJECT_NAME: ${{ vars.PROJECT_NAME }}
-
-jobs:
- publish:
- name: unlist on nuget
- runs-on: windows-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- # Unlist
- - name: Unlist Deleted Tag
- uses: darenm/unlist-nuget@v1
- with:
- NUGET_PACKAGE: ${{ env.PROJECT_NAME }} # Full Package ID
- VERSION_REGEX: ${{ github.event.release.tag_name }} # Regex pattern to match version
- NUGET_KEY: ${{ secrets.NUGET_API_KEY }} # nuget.org API key
\ No newline at end of file
diff --git a/.github/workflows/unlist_package.yml b/.github/workflows/unlist_package.yml
new file mode 100644
index 0000000..ed2c1d6
--- /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/.github/workflows/update-version.yml b/.github/workflows/update-version.yml
deleted file mode 100644
index 53a0115..0000000
--- a/.github/workflows/update-version.yml
+++ /dev/null
@@ -1,82 +0,0 @@
-name: Update Version
-
-on:
- workflow_dispatch:
- inputs:
- version_type:
- description: 'Update branch version by:'
- type: choice
- options:
- - major
- - minor
- - patch
- required: true
- default: 'patch'
-
-permissions:
- contents: write
- actions: read
-
-env:
- ALLOW_UPDATES: ${{ startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/hotfix/') }}
-
-jobs:
- update-version:
- runs-on: ubuntu-latest
- outputs:
- version_tag: ${{ env.version_tag }}
- previous_version_tag: ${{ env.previous_version_tag }}
-
- steps:
- - name: Check For Valid Updates
- if: env.ALLOW_UPDATES == false
- run: |
- echo "Version updates should only be done on development or hotfix"
- exit 1
-
- - name: Checkout Code
- uses: actions/checkout@v4
-
- - name: Run Update Version
- id: set_version
- shell: pwsh
- run: |
- Import-Module ./solution-helper.psm1 -Force
- $previousVersion, $newVersion = Update-Version -type ${{ github.event.inputs.version_type }}
- echo "version_tag=$newVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
- echo "previous_version_tag=$previousVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
-
- - name: Check for Existing Release
- run: |
- compare_versions() {
- echo -e "$1\n$2" | sort -V | tail -n 1
- }
-
- # Fetch the list of releases
- releases=$(gh release list --json createdAt,tagName --limit 100)
- echo -e "$releases"
-
- # Sort the releases by date and extract the most recent one
- latest_release=$(echo "$releases" | jq -r 'sort_by(.createdAt) | reverse | .[0] | .tagName')
- echo -e "$latest_release"
-
- greater_version=$(compare_versions $latest_release $version_tag)
-
- if [ "$greater_version" = "$version_tag" ]; then
- echo "✅ $version_tag is greater than $latest_release"
- elif [ "$greater_version" = "$latest_release" ]; then
- echo "⛔ $version_tag is less than $latest_release"
- exit 1
- else
- echo "⚠️ Versions are equal"
- exit 1
- fi
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- - name: Update Version Number
- run: |
- git config --global user.name '${{ github.triggering_actor }}'
- git config --global user.email '${{ github.triggering_actor }}@users.noreply.github.com'
- git commit -am "Previous version was '${{ env.previous_version_tag }}'. Version now '${{ env.version_tag }}'."
- git push
\ No newline at end of file
diff --git a/Directory.Build.props b/Directory.Build.props
index ab99ec2..2b13e73 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,26 +1,49 @@
-
-
-
- 2
- 5
- 0
-
-
-
- false
-
-
-
-
- true
- true
- true
- embedded
-
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+ true
+ true
+ true
+ true
+
+
+
+
+ README.md
+ LICENSE
+ true
+ assets/icon.png
+ https://github.com/Stillpoint-Software/Hyperbee.Collections/releases/latest
+ https://github.com/Stillpoint-Software/Hyperbee.Collections
+ git
+ https://github.com/Stillpoint-Software/Hyperbee.Collections
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/Directory.Build.targets b/Directory.Build.targets
deleted file mode 100644
index 8cea3b3..0000000
--- a/Directory.Build.targets
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
- $(MajorVersion).$(MinorVersion).$(PatchVersion)
- $(VersionPrefix)
- $(VersionPrefix)-$(VersionSuffix)
-
-
-
-
-
- --source $(PackageSource)
-
-
-
-
-
- --api-key $(PackageApiKey)
-
-
-
-
\ No newline at end of file
diff --git a/Hyperbee.Collections.sln b/Hyperbee.Collections.sln
index b118572..3995a05 100644
--- a/Hyperbee.Collections.sln
+++ b/Hyperbee.Collections.sln
@@ -6,8 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{870D9301-BE3D-44EA-BF9C-FCC2E87FE4CD}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
- Directory.Build.targets = Directory.Build.targets
- solution-helper.psm1 = solution-helper.psm1
+ LICENSE = LICENSE
+ README.md = README.md
+ version.json = version.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Tests", "Solution Tests", "{F9B24CD9-E06B-4834-84CB-8C29E5F10BE0}"
@@ -20,15 +21,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{1FA7
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{4DBDB7F5-3F66-4572-80B5-3322449C77A4}"
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\publish.yml = .github\workflows\publish.yml
- .github\workflows\test-report.yml = .github\workflows\test-report.yml
- .github\workflows\test.yml = .github\workflows\test.yml
- .github\workflows\unlist-nuget.yml = .github\workflows\unlist-nuget.yml
- .github\workflows\update-version.yml = .github\workflows\update-version.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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbee.Collections", "src\Hyperbee.Collections\Hyperbee.Collections.csproj", "{574DD649-BC5B-40F5-92E5-BE6A289D4C92}"
diff --git a/README.md b/README.md
index 1cc27ee..81e13e8 100644
--- a/README.md
+++ b/README.md
@@ -86,6 +86,7 @@ The `DisjointSet` class provides an implementation of the union-find algorithm,
- **Size**: The size of the underlying data structure.
#### Methods
+- `void Clear()`: Clears the set.
- `bool TryAdd(T item)`: Creates a new set containing the specified item.
- `bool TryAdd(IEnumerable items)`: Creates a new set containing the specified items.
- `T Find(T item)`: Finds the representative of the set containing the specified item.
@@ -255,3 +256,16 @@ Special thanks to:
We welcome contributions! Please see our [Contributing Guide](https://github.com/Stillpoint-Software/.github/blob/main/.github/CONTRIBUTING.md)
for more details.
+
+# Status
+
+| Branch | Action |
+|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `develop` | [](https://github.com/Stillpoint-Software/Hyperbee.Collections/actions/workflows/pack_publish.yml) |
+| `main` | [](https://github.com/Stillpoint-Software/Hyperbee.Collections/actions/workflows/pack_publish.yml) |
+
+# Help
+ See [Todo](https://github.com/Stillpoint-Software/Hyperbee.Collections/blob/main/docs/todo.md)
+
+[](https://github.com/Stillpoint-Software/Hyperbee.Collections)
+
diff --git a/solution-helper.psm1 b/solution-helper.psm1
deleted file mode 100644
index f59e729..0000000
--- 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/src/Hyperbee.Collections/DisjointSet.cs b/src/Hyperbee.Collections/DisjointSet.cs
index fda4d5f..7381a9c 100644
--- a/src/Hyperbee.Collections/DisjointSet.cs
+++ b/src/Hyperbee.Collections/DisjointSet.cs
@@ -7,6 +7,7 @@ public interface IDisjointSet : IReadOnlyCollection
public IEnumerable Keys { get; }
bool AreConnected( T item1, T item2 );
+ void Clear();
bool TryAdd( T item );
bool TryAdd( IEnumerable items );
T Find( T item );
@@ -37,6 +38,11 @@ public DisjointSet( OnDisjointUnion onDisjointUnion, IEqualityComparer compar
public int Count => _parent.Count;
+ public void Clear()
+ {
+ _parent.Clear();
+ }
+
public bool AreConnected( T item1, T item2 )
{
// Check if both items are in the same group by comparing their representatives
diff --git a/version.json b/version.json
new file mode 100644
index 0000000..eb56159
--- /dev/null
+++ b/version.json
@@ -0,0 +1,9 @@
+{
+ "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
+ "version": "2.5.0",
+ "publicReleaseRefSpec": [
+ "^refs/heads/main$",
+ "^refs/heads/hotfix$",
+ "^refs/heads/v\\d+\\.\\d+$"
+ ]
+}
\ No newline at end of file