From 110c9ec6a19847b6232ba97a4b5c7f61b50ebe26 Mon Sep 17 00:00:00 2001 From: "annette.findley" Date: Wed, 13 Aug 2025 15:13:08 -0400 Subject: [PATCH 1/4] updated workflows to use the new system --- .github/workflows/Create Issue Branch.yml | 23 -- .github/workflows/Create Release.yml | 58 ----- .github/workflows/Format.yml | 71 +++--- .github/workflows/Publish.yml | 83 ------- .github/workflows/Test Report.yml | 29 --- .github/workflows/Test.yml | 61 ----- .github/workflows/Unlist Nuget.yml | 26 --- .github/workflows/Update Version.yml | 78 ------- .github/workflows/create_release.yml | 74 ++++++ .github/workflows/create_test_report.yml | 39 ++++ ...tHub Pages.yml => deploy_github_pages.yml} | 0 .github/workflows/issue_branch.yml | 35 +++ .github/workflows/pack_publish.yml | 27 +++ .github/workflows/run_tests.yml | 48 ++++ .github/workflows/unlist_package.yml | 32 +++ Directory.Build.props | 55 +++-- Directory.Build.targets | 38 ---- Hyperbee.Resources.sln | 19 +- solution-helper.psm1 | 213 ------------------ version.json | 9 + 20 files changed, 349 insertions(+), 669 deletions(-) delete mode 100644 .github/workflows/Create Issue Branch.yml delete mode 100644 .github/workflows/Create Release.yml delete mode 100644 .github/workflows/Publish.yml delete mode 100644 .github/workflows/Test Report.yml delete mode 100644 .github/workflows/Test.yml delete mode 100644 .github/workflows/Unlist Nuget.yml delete mode 100644 .github/workflows/Update Version.yml create mode 100644 .github/workflows/create_release.yml create mode 100644 .github/workflows/create_test_report.yml rename .github/workflows/{Deploy GitHub Pages.yml => deploy_github_pages.yml} (100%) create mode 100644 .github/workflows/issue_branch.yml create mode 100644 .github/workflows/pack_publish.yml create mode 100644 .github/workflows/run_tests.yml create mode 100644 .github/workflows/unlist_package.yml delete mode 100644 Directory.Build.targets delete mode 100644 solution-helper.psm1 create mode 100644 version.json diff --git a/.github/workflows/Create Issue Branch.yml b/.github/workflows/Create Issue Branch.yml deleted file mode 100644 index e27bab4..0000000 --- a/.github/workflows/Create Issue Branch.yml +++ /dev/null @@ -1,23 +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 ] - -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/Create Release.yml b/.github/workflows/Create Release.yml deleted file mode 100644 index 638f74c..0000000 --- a/.github/workflows/Create Release.yml +++ /dev/null @@ -1,58 +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 - -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 }} diff --git a/.github/workflows/Format.yml b/.github/workflows/Format.yml index b106b8e..3adcfc2 100644 --- a/.github/workflows/Format.yml +++ b/.github/workflows/Format.yml @@ -1,43 +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 + pull-requests: write + actions: read -env: - DOTNET_VERSION: '9.0.x' - 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 + - 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 - - 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 + # 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 bcc5980..0000000 --- a/.github/workflows/Publish.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Publish - -on: - workflow_dispatch: - release: - types: [published] - -env: - BRANCH_NAME: ${{ github.event.release.target_commitish }} - SOLUTION_NAME: ${{ vars.SOLUTION_NAME }} - DOTNET_VERSION: '9.0.x' - NUGET_SOURCE: 'https://api.nuget.org/v3/index.json' - BUILD_CONFIGURATION: '' - VERSION_SUFFIX: '' - -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: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 Report.yml b/.github/workflows/Test Report.yml deleted file mode 100644 index 852a7fe..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 diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml deleted file mode 100644 index 23289f8..0000000 --- a/.github/workflows/Test.yml +++ /dev/null @@ -1,61 +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 - -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@v4 # 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/Unlist Nuget.yml b/.github/workflows/Unlist Nuget.yml deleted file mode 100644 index d10f01a..0000000 --- a/.github/workflows/Unlist Nuget.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Unlist NuGet - -on: - workflow_dispatch: - # release: - # types: [deleted] - -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 diff --git a/.github/workflows/Update Version.yml b/.github/workflows/Update Version.yml deleted file mode 100644 index 050a368..0000000 --- a/.github/workflows/Update Version.yml +++ /dev/null @@ -1,78 +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' - -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 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/Deploy GitHub Pages.yml b/.github/workflows/deploy_github_pages.yml similarity index 100% rename from .github/workflows/Deploy GitHub Pages.yml rename to .github/workflows/deploy_github_pages.yml 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/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/Directory.Build.props b/Directory.Build.props index 7cc90a2..43bf9c3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,26 +1,43 @@ - - - - 2 - 0 - 2 - - - - false - - - - - true - true - true - embedded - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + true + true + true + true + + + + + + README.md + + + https://github.com/Stillpoint-Software/Hyperbee.Resources/releases/latest + + + https://github.com/Stillpoint-Software/Hyperbee.Resources + git + https://github.com/Stillpoint-Software/Hyperbee.Resources + + + + + + \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets deleted file mode 100644 index ab19c8b..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.Resources.sln b/Hyperbee.Resources.sln index dcd5fff..5770ffd 100644 --- a/Hyperbee.Resources.sln +++ b/Hyperbee.Resources.sln @@ -6,10 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D9648393-6F08-43BB-A860-CE7E5518E23F}" ProjectSection(SolutionItems) = preProject Directory.Build.props = Directory.Build.props - Directory.Build.targets = Directory.Build.targets LICENSE = LICENSE README.md = README.md - solution-helper.psm1 = solution-helper.psm1 + version.json = version.json EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Tests", "Solution Tests", "{3578FD7E-CD36-4C2B-974C-52C56F7B60AB}" @@ -24,14 +23,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbee.Resources", "src\H EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{3F11E2F8-DDBB-4CEC-8364-ADBC05A17E9D}" ProjectSection(SolutionItems) = preProject - .github\workflows\Create Issue Branch.yml = .github\workflows\Create Issue Branch.yml - .github\workflows\Create Release.yml = .github\workflows\Create Release.yml - .github\workflows\Format.yml = .github\workflows\Format.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\format.yml = .github\workflows\format.yml + .github\workflows\create_test_report.yml = .github\workflows\create_test_report.yml + .github\workflows\create_release.yml = .github\workflows\create_release.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 + .github\workflows\deploy_github_pages.yml = .github\workflows\deploy_github_pages.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hyperbee.Resources.Tests", "test\Hyperbee.Resources.Tests\Hyperbee.Resources.Tests.csproj", "{C9DFA58D-268B-4CCD-807C-ECB81053856B}" 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/version.json b/version.json new file mode 100644 index 0000000..1e97407 --- /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.0.2", + "publicReleaseRefSpec": [ + "^refs/heads/main$", + "^refs/heads/hotfix$", + "^refs/heads/v\\d+\\.\\d+$" + ] +} \ No newline at end of file From 6439240075edf5a8c90f04fee31e478a0353b121 Mon Sep 17 00:00:00 2001 From: "annette.findley" Date: Thu, 14 Aug 2025 09:18:13 -0400 Subject: [PATCH 2/4] updated build props to include license --- Directory.Build.props | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 43bf9c3..463159e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,6 +3,7 @@ + all @@ -12,7 +13,6 @@ - true true true @@ -21,23 +21,27 @@ - README.md + LICENSE.txt + true - https://github.com/Stillpoint-Software/Hyperbee.Resources/releases/latest - https://github.com/Stillpoint-Software/Hyperbee.Resources git https://github.com/Stillpoint-Software/Hyperbee.Resources - + + + \ No newline at end of file From 2bf103c93791a0a20fcf896df0258aac8a28f117 Mon Sep 17 00:00:00 2001 From: "annette.findley" Date: Thu, 14 Aug 2025 09:43:13 -0400 Subject: [PATCH 3/4] updated build props to include license --- Directory.Build.props | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 463159e..b4b9bfb 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,6 +9,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + @@ -22,26 +24,27 @@ README.md - LICENSE.txt + LICENSE true - https://github.com/Stillpoint-Software/Hyperbee.Resources/releases/latest + https://github.com/Stillpoint-Software/Hyperbee.Collections/releases/latest - https://github.com/Stillpoint-Software/Hyperbee.Resources + https://github.com/Stillpoint-Software/Hyperbee.Collections git - https://github.com/Stillpoint-Software/Hyperbee.Resources + https://github.com/Stillpoint-Software/Hyperbee.Collections + - + Link="LICENSE" /> \ No newline at end of file From d91dde6aba5a0a94e714874ef9a5bb58df8249b0 Mon Sep 17 00:00:00 2001 From: "annette.findley" Date: Thu, 14 Aug 2025 12:40:53 -0400 Subject: [PATCH 4/4] update README with image and build-status badge --- Directory.Build.props | 3 +-- README.md | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index b4b9bfb..9bc9409 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -26,9 +26,8 @@ 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 diff --git a/README.md b/README.md index dc4f4cd..afe8d51 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ Inject IResourceProvider to use. | Branch | Action | |------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `develop` | [![Build status](https://github.com/Stillpoint-Software/hyperbee.resources/actions/workflows/publish.yml/badge.svg?branch=develop)](https://github.com/Stillpoint-Software/hyperbee.resources/actions/workflows/publish.yml) | -| `main` | [![Build status](https://github.com/Stillpoint-Software/hyperbee.resources/actions/workflows/publish.yml/badge.svg)](https://github.com/Stillpoint-Software/hyperbee.resources/actions/workflows/publish.yml) | +| `develop` | [![Build status](https://github.com/Stillpoint-Software/hyperbee.resources/actions/workflows/publish.yml/badge.svg?branch=develop)](https://github.com/Stillpoint-Software/hyperbee.resources/actions/workflows/pack_publish.yml) | +| `main` | [![Build status](https://github.com/Stillpoint-Software/hyperbee.resources/actions/workflows/publish.yml/badge.svg)](https://github.com/Stillpoint-Software/hyperbee.resources/actions/workflows/pack_publish.yml) | # Benchmarks