Skip to content

Commit 74b2bad

Browse files
committed
CLOUDP-226369: Allow backport releases
Signed-off-by: jose.vazquez <[email protected]>
1 parent 2fcc060 commit 74b2bad

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.github/actions/releaser/cr.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ set -o errexit
88
set -o nounset
99
set -o pipefail
1010

11+
set -x
12+
1113
main() {
1214
local version=${VERSION:-v1.2.1}
1315
local charts_dir=${CHART_DIR:-charts}
@@ -52,13 +54,12 @@ release_charts_inside_folders() {
5254

5355
chart_name=$(read_chart_name "${charts_dir}/${folder}")
5456
chart_version=$(read_chart_version "${charts_dir}/${folder}")
55-
echo "Checking if \"$charts_dir/$folder\" has been released to the repo"
5657
chart_was_released=$(chart_released "${chart_name}" "${chart_version}")
5758

5859
echo "released result: \"${chart_was_released}\""
5960

6061
# if chart is not released or folder has change, then remember as changed_charts
61-
if [ -z "${chart_was_released}" ] || has_changed "$folder"; then
62+
if [ "${chart_was_released}" == "Not found" ] || has_changed "$folder"; then
6263
changed_charts+=("$folder")
6364
fi
6465
done

.github/workflows/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
- '.github/**'
99
workflow_dispatch:
1010
inputs:
11+
backport-branch:
12+
description: "Select backport branch if different from 'main'"
13+
type: string
14+
default: "main"
15+
required: true
1116
target:
1217
description: "target chart to release"
1318
type: string
@@ -22,10 +27,20 @@ on:
2227
jobs:
2328
build:
2429
runs-on: ubuntu-latest
30+
env:
31+
BACKPORT_BRANCH: ${{ github.event.inputs.backport-branch || 'main' }}
32+
BACKPORT_DIR: 'backport'
2533
steps:
2634
- name: Checkout
2735
uses: actions/checkout@v4
2836

37+
- name: Checkout Backport branch
38+
uses: actions/checkout@v4
39+
if: github.event.inputs.backport-branch != 'main'
40+
with:
41+
ref: ${{ env.BACKPORT_BRANCH }}
42+
path: ${{ env.BACKPORT_DIR }}
43+
2944
- name: Configure Git
3045
run: |
3146
git config user.name "$GITHUB_ACTOR"
@@ -64,7 +79,9 @@ jobs:
6479
uses: ./.github/actions/releaser
6580
env:
6681
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
82+
CHARTS_DIR: ${{ github.event.inputs.backport-branch == 'main' && 'charts' || format('{0}/charts', env.BACKPORT_DIR) }}
6783
with:
6884
charts_repo_url: https://mongodb.github.io/helm-charts
6985
target: ${{ github.event.inputs.target }}
7086
dryrun: ${{ github.event.inputs.dryrun }}
87+
charts_dir: ${{ env.CHARTS_DIR }}

0 commit comments

Comments
 (0)