Skip to content

Create Release Branches - create-hotfix-release-branch - 2025.1.4.1 #9

Create Release Branches - create-hotfix-release-branch - 2025.1.4.1

Create Release Branches - create-hotfix-release-branch - 2025.1.4.1 #9

name: Create Release Branches
run-name: "Create Release Branches - ${{ inputs.mode }} - ${{ inputs.spring_cloud_release_train }}"
# Runs one of the single-project branch-creation workflows for every project in a release
# train that does not have its release branch yet.
#
# create-oss-release-branch OSS release; reads <train>-INTERNAL-SNAPSHOT
# create-commercial-release-branch commercial-only release; reads <train>
# create-hotfix-release-branch hotfix; reads <train>, the 4-segment (x.y.z.h) projects only
#
# The projects and their versions come from the same jenkins-releaser-config properties file
# the chosen workflow reads (spring-cloud-release-commercial@jenkins-releaser-config). For
# each project the branch that workflow would create is derived, and looked up in
# <project>-commercial; projects whose branch already exists are skipped, so re-running after
# a partial failure only picks up what is left. The plan logic is
# .github/scripts/release-branch-plan.js.
#
# Each child run is dispatched and waited on. A failing child fails this run, but does not
# stop the others.
on:
workflow_dispatch:
inputs:
mode:
description: 'Which branch-creation workflow to run for each project'
required: true
type: choice
options:
- create-oss-release-branch
- create-commercial-release-branch
- create-hotfix-release-branch
spring_cloud_release_train:
description: 'Spring Cloud release train version (e.g. 2026.1.0, 2026.0.0-M1 or 2026.0.0-RC2 for OSS; 2025.1.2 for a hotfix)'
required: true
type: string
spring_release_train:
description: 'Spring release train every project joins (e.g. 2026.1)'
required: true
type: string
use_tag:
description: 'Hotfix only: create each branch from its OSS tag instead of the -internal branch'
required: false
type: boolean
default: false
sha:
description: 'Commit SHA of this repo to copy release-train action files from (OSS and hotfix only). Defaults to the commit that triggered this workflow.'
required: false
type: string
default: ''
permissions:
contents: read
jobs:
plan:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.plan.outputs.matrix }}
has_work: ${{ steps.plan.outputs.has_work }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Work out which projects need a release branch
id: plan
env:
GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
MODE: ${{ inputs.mode }}
TRAIN: ${{ inputs.spring_cloud_release_train }}
run: node .github/scripts/release-branch-plan.js "$MODE" "$TRAIN"
create:
name: ${{ inputs.mode }} - ${{ matrix.project }} (${{ matrix.branch }})
needs: plan
if: ${{ needs.plan.outputs.has_work == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 5
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
# The commercial workflow takes the branch to cut from as an input; the other two
# derive it themselves. Same resolution create-oss-release-branch uses, against the
# commercial repo, which has no main to fall back on.
- name: Resolve the commercial source branch
id: source
if: ${{ inputs.mode == 'create-commercial-release-branch' }}
uses: ./.github/actions/resolve-release-branch
with:
repo: spring-cloud/${{ matrix.project }}-commercial
version: ${{ matrix.version }}
commercial: 'true'
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
- name: Build the ${{ inputs.mode }} inputs
id: inputs
env:
MODE: ${{ inputs.mode }}
PROJECT: ${{ matrix.project }}
TRAIN: ${{ inputs.spring_cloud_release_train }}
SPRING_TRAIN: ${{ inputs.spring_release_train }}
USE_TAG: ${{ inputs.use_tag }}
SHA: ${{ inputs.sha }}
SOURCE_BRANCH: ${{ steps.source.outputs.branch }}
SOURCE_STATUS: ${{ steps.source.outputs.status }}
SOURCE_MESSAGE: ${{ steps.source.outputs.message }}
run: |
set -euo pipefail
lines=()
case "$MODE" in
create-oss-release-branch)
lines+=("oss_repo=${PROJECT}" "spring_cloud_release_train=${TRAIN}"
"spring_release_train=${SPRING_TRAIN}")
[[ -n "$SHA" ]] && lines+=("sha=${SHA}")
;;
create-hotfix-release-branch)
lines+=("oss_repo=${PROJECT}" "release_train_version=${TRAIN}"
"spring_release_train=${SPRING_TRAIN}" "use_tag=${USE_TAG}")
[[ -n "$SHA" ]] && lines+=("sha=${SHA}")
;;
create-commercial-release-branch)
if [[ "$SOURCE_STATUS" != "ok" ]]; then
echo "::error::Could not resolve the source branch for ${PROJECT}-commercial: ${SOURCE_MESSAGE}"
exit 1
fi
lines+=("project=${PROJECT}-commercial" "branch=${SOURCE_BRANCH}"
"release-train=${SPRING_TRAIN}")
;;
esac
{
echo "inputs<<INPUTS_EOF"
printf '%s\n' "${lines[@]}"
echo "INPUTS_EOF"
} >> "$GITHUB_OUTPUT"
- name: Dispatch ${{ inputs.mode }} and wait
uses: ./.github/actions/dispatch-and-wait
with:
repo: ${{ github.repository }}
workflow: ${{ inputs.mode }}.yml
ref: ${{ github.ref_name }}
inputs: ${{ steps.inputs.outputs.inputs }}
summary-title: ${{ matrix.project }}
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}