From 39e58fb6795bb37ceacbc2cbf92a5721ff536228 Mon Sep 17 00:00:00 2001 From: Joe DeCock Date: Fri, 25 Jul 2025 09:11:49 -0500 Subject: [PATCH] Improve version validation messages --- .github/workflow-gen/Program.cs | 2 +- .github/workflow-gen/StepExtensions.cs | 6 +++--- .../aspnetcore-authentication-jwtbearer-release.yml | 4 ++-- .github/workflows/bff-release.yml | 4 ++-- .github/workflows/identity-server-release.yml | 4 ++-- .github/workflows/templates-release.yml | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflow-gen/Program.cs b/.github/workflow-gen/Program.cs index 7133e0549..72b569af9 100644 --- a/.github/workflow-gen/Program.cs +++ b/.github/workflow-gen/Program.cs @@ -237,7 +237,7 @@ void GenerateReleaseWorkflow(Product product) job.Step() .Name("Validate Version Input") - .Run($@"echo '{contexts.Event.Input.Version}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$'"); + .Run($@"echo '{contexts.Event.Input.Version}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$' || (echo 'Invalid version format' && exit 1)"); job.StepGitCheckoutCustomBranch(); job.StepGitConfig(); diff --git a/.github/workflow-gen/StepExtensions.cs b/.github/workflow-gen/StepExtensions.cs index e7bf0eae8..d4d5ed08a 100644 --- a/.github/workflow-gen/StepExtensions.cs +++ b/.github/workflow-gen/StepExtensions.cs @@ -182,7 +182,7 @@ public static class StepExtensions public static WorkflowDispatch InputVersionBranchAndTagOverride(this WorkflowDispatch workflow) => workflow.Inputs( - new StringInput("version", "Version in format X.Y.Z or X.Y.Z-preview.", true, "0.0.0"), + new StringInput("version", "Version in format X.Y.Z, X.Y.Z-preview.N, or X.Y.Z-rc.N", true, "0.0.0"), new StringInput("branch", "(Optional) the name of the branch to release from", false, "main"), new BooleanInput("remove-tag-if-exists", "If set, will remove the existing tag. Use this if you have issues with the previous release action", false, false)); @@ -225,14 +225,14 @@ public static class StepExtensions /// Only (trusted) contributors can open branches in the main repo, so these builds can run with a higher trust level. /// So, they are running with trigger 'push'. These builds have access to the secrets and thus they can do things like /// sign, push the packages, etc.. - /// + /// /// External contributors can only create branches on external repo's. These builds run with a lower trust level. /// So, they are running with trigger 'pull_request'. These builds do not have access to the secrets and thus they can't /// sign, push the packages, etc.. /// /// Now, if a trusted contributor creates a branch in the main repo, then creates a PR, we don't want to run the build twice. /// This prevents that. The build will only run once, on the branch with the higher trust level. - /// + /// /// public static Job RunEitherOnBranchOrAsPR(this Job job) => job.If( diff --git a/.github/workflows/aspnetcore-authentication-jwtbearer-release.yml b/.github/workflows/aspnetcore-authentication-jwtbearer-release.yml index cc1019bbf..fafbd4561 100644 --- a/.github/workflows/aspnetcore-authentication-jwtbearer-release.yml +++ b/.github/workflows/aspnetcore-authentication-jwtbearer-release.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: inputs: version: - description: 'Version in format X.Y.Z or X.Y.Z-preview.' + description: 'Version in format X.Y.Z, X.Y.Z-preview.N, or X.Y.Z-rc.N' type: string required: true default: '0.0.0' @@ -39,7 +39,7 @@ jobs: with: fetch-depth: 0 - name: Validate Version Input - run: echo '${{ github.event.inputs.version }}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$' + run: echo '${{ github.event.inputs.version }}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$' || (echo 'Invalid version format' && exit 1) - name: Checkout target branch if: github.event.inputs.branch != 'main' run: git checkout ${{ github.event.inputs.branch }} diff --git a/.github/workflows/bff-release.yml b/.github/workflows/bff-release.yml index 7943b8f48..8ea18f22a 100644 --- a/.github/workflows/bff-release.yml +++ b/.github/workflows/bff-release.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: inputs: version: - description: 'Version in format X.Y.Z or X.Y.Z-preview.' + description: 'Version in format X.Y.Z, X.Y.Z-preview.N, or X.Y.Z-rc.N' type: string required: true default: '0.0.0' @@ -39,7 +39,7 @@ jobs: with: fetch-depth: 0 - name: Validate Version Input - run: echo '${{ github.event.inputs.version }}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$' + run: echo '${{ github.event.inputs.version }}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$' || (echo 'Invalid version format' && exit 1) - name: Checkout target branch if: github.event.inputs.branch != 'main' run: git checkout ${{ github.event.inputs.branch }} diff --git a/.github/workflows/identity-server-release.yml b/.github/workflows/identity-server-release.yml index 90195243f..3d70b6150 100644 --- a/.github/workflows/identity-server-release.yml +++ b/.github/workflows/identity-server-release.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: inputs: version: - description: 'Version in format X.Y.Z or X.Y.Z-preview.' + description: 'Version in format X.Y.Z, X.Y.Z-preview.N, or X.Y.Z-rc.N' type: string required: true default: '0.0.0' @@ -39,7 +39,7 @@ jobs: with: fetch-depth: 0 - name: Validate Version Input - run: echo '${{ github.event.inputs.version }}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$' + run: echo '${{ github.event.inputs.version }}' | grep -P '^\d+\.\d+\.\d+(-preview\.\d+|-rc\.\d+)?$' || (echo 'Invalid version format' && exit 1) - name: Checkout target branch if: github.event.inputs.branch != 'main' run: git checkout ${{ github.event.inputs.branch }} diff --git a/.github/workflows/templates-release.yml b/.github/workflows/templates-release.yml index 6fd758399..d3f86bc53 100644 --- a/.github/workflows/templates-release.yml +++ b/.github/workflows/templates-release.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: inputs: version: - description: 'Version in format X.Y.Z or X.Y.Z-preview.' + description: 'Version in format X.Y.Z, X.Y.Z-preview.N, or X.Y.Z-rc.N' type: string required: true default: '0.0.0'