Repository navigation
150 lines (138 loc) · 5.8 KB
/
Copy pathcreate-release-branches.yml
File metadata and controls
150 lines (138 loc) · 5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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 }}