From 577a5098c64eb1f03fd33c524339893d3e447518 Mon Sep 17 00:00:00 2001 From: Erwin van der Valk Date: Mon, 17 Feb 2025 14:15:26 +0100 Subject: [PATCH] Merge pull request #105 from DuendeSoftware/ev/build-release-from-target-branch Build - Add capability to release from target branch --- .github/workflow-gen/Program.cs | 8 +++++++- .github/workflows/access-token-management-release.yml | 11 +++++++---- .../workflows/identity-model-oidc-client-release.yml | 11 +++++++---- .github/workflows/identity-model-release.yml | 11 +++++++---- .github/workflows/ignore-this-release.yml | 11 +++++++---- 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/.github/workflow-gen/Program.cs b/.github/workflow-gen/Program.cs index 44748172..7d716133 100644 --- a/.github/workflow-gen/Program.cs +++ b/.github/workflow-gen/Program.cs @@ -108,7 +108,8 @@ void GenerateReleaseWorkflow(Component component) workflow.On .WorkflowDispatch() - .Inputs(new StringInput("version", "Version in format X.Y.Z or X.Y.Z-preview.", true, "0.0.0")); + .Inputs(new StringInput("version", "Version in format X.Y.Z or X.Y.Z-preview.", true, "0.0.0")) + .Inputs(new StringInput("target-branch", "(Optional) the name of the branch to release from", false, "main")); workflow.EnvDefaults(); @@ -122,6 +123,11 @@ void GenerateReleaseWorkflow(Component component) tagJob.Step() .ActionsCheckout(); + tagJob.Step() + .Name("Checkout target branch") + .If("github.event.inputs.branch != 'main'") + .Run("git checkout ${{ github.event.inputs.branch }}"); + tagJob.StepSetupDotNet(); tagJob.Step() diff --git a/.github/workflows/access-token-management-release.yml b/.github/workflows/access-token-management-release.yml index 84e74bac..fcb6485a 100644 --- a/.github/workflows/access-token-management-release.yml +++ b/.github/workflows/access-token-management-release.yml @@ -4,11 +4,11 @@ name: access-token-management/release on: workflow_dispatch: inputs: - version: - description: 'Version in format X.Y.Z or X.Y.Z-preview.' + target-branch: + description: '(Optional) the name of the branch to release from' type: string - required: true - default: '0.0.0' + required: false + default: 'main' env: DOTNETT_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -28,6 +28,9 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Checkout target branch + if: github.event.inputs.branch != 'main' + run: git checkout ${{ github.event.inputs.branch }} - name: Setup Dotnet uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 with: diff --git a/.github/workflows/identity-model-oidc-client-release.yml b/.github/workflows/identity-model-oidc-client-release.yml index fa71feca..e92e0b01 100644 --- a/.github/workflows/identity-model-oidc-client-release.yml +++ b/.github/workflows/identity-model-oidc-client-release.yml @@ -4,11 +4,11 @@ name: identity-model-oidc-client/release on: workflow_dispatch: inputs: - version: - description: 'Version in format X.Y.Z or X.Y.Z-preview.' + target-branch: + description: '(Optional) the name of the branch to release from' type: string - required: true - default: '0.0.0' + required: false + default: 'main' env: DOTNETT_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -28,6 +28,9 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Checkout target branch + if: github.event.inputs.branch != 'main' + run: git checkout ${{ github.event.inputs.branch }} - name: Setup Dotnet uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 with: diff --git a/.github/workflows/identity-model-release.yml b/.github/workflows/identity-model-release.yml index cf91d1eb..a54021f6 100644 --- a/.github/workflows/identity-model-release.yml +++ b/.github/workflows/identity-model-release.yml @@ -4,11 +4,11 @@ name: identity-model/release on: workflow_dispatch: inputs: - version: - description: 'Version in format X.Y.Z or X.Y.Z-preview.' + target-branch: + description: '(Optional) the name of the branch to release from' type: string - required: true - default: '0.0.0' + required: false + default: 'main' env: DOTNETT_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -28,6 +28,9 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Checkout target branch + if: github.event.inputs.branch != 'main' + run: git checkout ${{ github.event.inputs.branch }} - name: Setup Dotnet uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 with: diff --git a/.github/workflows/ignore-this-release.yml b/.github/workflows/ignore-this-release.yml index 755e9052..936d592a 100644 --- a/.github/workflows/ignore-this-release.yml +++ b/.github/workflows/ignore-this-release.yml @@ -4,11 +4,11 @@ name: ignore-this/release on: workflow_dispatch: inputs: - version: - description: 'Version in format X.Y.Z or X.Y.Z-preview.' + target-branch: + description: '(Optional) the name of the branch to release from' type: string - required: true - default: '0.0.0' + required: false + default: 'main' env: DOTNETT_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true @@ -28,6 +28,9 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Checkout target branch + if: github.event.inputs.branch != 'main' + run: git checkout ${{ github.event.inputs.branch }} - name: Setup Dotnet uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25 with: