From fb4cc1c19c71ef65a76bd1042d72fb241ff45999 Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Mon, 11 Mar 2024 14:01:38 -0400 Subject: [PATCH 1/2] SHIP-0038: Release Branch Workflows Creating a reusable GitHub Actions workflow to set up release branches in Shipwright projects, and a corresponding starter workflow template. These workflows will let Shipwright projects opt into setting up release branches for project artifacts. The workflows allow branches to be created at specific git references, allowing release branches to be set up retroactively. Signed-off-by: Adam Kaplan --- .github/workflows/release-branch.yml | 25 +++++++++++++++++++ .../release-branch.properties.json | 8 ++++++ workflow-templates/release-branch.yml | 23 +++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 .github/workflows/release-branch.yml create mode 100644 workflow-templates/release-branch.properties.json create mode 100644 workflow-templates/release-branch.yml diff --git a/.github/workflows/release-branch.yml b/.github/workflows/release-branch.yml new file mode 100644 index 0000000..fcaa866 --- /dev/null +++ b/.github/workflows/release-branch.yml @@ -0,0 +1,25 @@ +# Reusable release brancher workflow +# See SHIP-0038: https://github.com/shipwright-io/community/pull/194 +name: Release Brancher +on: + workflow_call: + inputs: + release-version: + required: true + type: string + git-ref: + required: false + type: string +jobs: + release-brancher: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.git-ref }} + - name: Create release branch + env: + RELEASE_VERSION: release-${{ inputs.release-version }} + run: | + git switch -c "${RELEASE_VERSION}" + git push --set-upstream origin "${RELEASE_VERSION}" diff --git a/workflow-templates/release-branch.properties.json b/workflow-templates/release-branch.properties.json new file mode 100644 index 0000000..5c012e9 --- /dev/null +++ b/workflow-templates/release-branch.properties.json @@ -0,0 +1,8 @@ +{ + "name": "adambkaplan Release Brancher", + "description": "Starter workflow for creating release branches", + "iconName": "octicon git-branch", + "categories": [ + "Automation" + ] +} diff --git a/workflow-templates/release-branch.yml b/workflow-templates/release-branch.yml new file mode 100644 index 0000000..36bc151 --- /dev/null +++ b/workflow-templates/release-branch.yml @@ -0,0 +1,23 @@ +# Release branch starter workflow +# See SHIP-0038: https://github.com/shipwright-io/community/pull/194 +name: Create Release Branch +on: + workflow_dispatch: + inputs: + release-version: + required: true + type: string + description: "Semantic version for the release branch (vX.Y format)" + git-ref: + required: false + type: string + description: "Git ref to create the release branch from (defaults to main)" + default: "main" +jobs: + create-release-branch: + permissions: + contents: write + uses: shipwright-io/.github/.github/workflows/release-branch.yml@main + with: + release-version: ${{ inputs.release-version }} + git-ref: ${{ inputs.git-ref }} From 925d166ffcf894c36dc49d5ceec760547739c8de Mon Sep 17 00:00:00 2001 From: Adam Kaplan Date: Tue, 19 Mar 2024 15:12:38 -0400 Subject: [PATCH 2/2] Apply suggestions from code review - Fix copy/paste issue in starter workflow name - Ensure the git-ref is always populated when creating a release branch Co-authored-by: Sascha Schwarze --- workflow-templates/release-branch.properties.json | 2 +- workflow-templates/release-branch.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow-templates/release-branch.properties.json b/workflow-templates/release-branch.properties.json index 5c012e9..fef5538 100644 --- a/workflow-templates/release-branch.properties.json +++ b/workflow-templates/release-branch.properties.json @@ -1,5 +1,5 @@ { - "name": "adambkaplan Release Brancher", + "name": "Release Brancher", "description": "Starter workflow for creating release branches", "iconName": "octicon git-branch", "categories": [ diff --git a/workflow-templates/release-branch.yml b/workflow-templates/release-branch.yml index 36bc151..e1bdd92 100644 --- a/workflow-templates/release-branch.yml +++ b/workflow-templates/release-branch.yml @@ -9,7 +9,7 @@ on: type: string description: "Semantic version for the release branch (vX.Y format)" git-ref: - required: false + required: true type: string description: "Git ref to create the release branch from (defaults to main)" default: "main"