Skip to content

Commit

Permalink
CLOUDP-226369: Allow backport releases
Browse files Browse the repository at this point in the history
Signed-off-by: jose.vazquez <[email protected]>
  • Loading branch information
josvazg committed Feb 5, 2024
1 parent 2fcc060 commit feafdaf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/actions/releaser/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ runs:
export OWNER=$owner
export REPO=$repo
cat "$GITHUB_ACTION_PATH/cr.sh"
"$GITHUB_ACTION_PATH/cr.sh" "${{ inputs.target }}"
8 changes: 5 additions & 3 deletions .github/actions/releaser/cr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set -o errexit
set -o nounset
set -o pipefail

set -x

main() {
local version=${VERSION:-v1.2.1}
local charts_dir=${CHART_DIR:-charts}
Expand Down Expand Up @@ -52,13 +54,12 @@ release_charts_inside_folders() {

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

echo "released result: \"${chart_was_released}\""
echo "Released result is \"${chart_was_released}\""

# if chart is not released or folder has change, then remember as changed_charts
if [ -z "${chart_was_released}" ] || has_changed "$folder"; then
if [ "${chart_was_released}" == "Not found" ] || has_changed "$folder"; then
changed_charts+=("$folder")
fi
done
Expand Down Expand Up @@ -232,5 +233,6 @@ update_index() {
cr index "${args[@]}"
}

echo "MODIFIED VERSION!"
mapfile -t target< <(echo "$1" )
main "${target[@]}"
17 changes: 17 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
- '.github/**'
workflow_dispatch:
inputs:
backport-branch:
description: "Select backport branch if different from 'main'"
type: string
default: "main"
required: true
target:
description: "target chart to release"
type: string
Expand All @@ -22,10 +27,20 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
BACKPORT_BRANCH: ${{ github.event.inputs.backport-branch || 'main' }}
BACKPORT_DIR: 'backport'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Checkout Backport branch
uses: actions/checkout@v4
if: github.event.inputs.backport-branch != 'main'
with:
ref: ${{ env.BACKPORT_BRANCH }}
path: ${{ env.BACKPORT_DIR }}

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
Expand Down Expand Up @@ -64,7 +79,9 @@ jobs:
uses: ./.github/actions/releaser
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CHARTS_DIR: ${{ github.event.inputs.backport-branch == 'main' && 'charts' || format('{0}/charts', env.BACKPORT_DIR) }}
with:
charts_repo_url: https://mongodb.github.io/helm-charts
target: ${{ github.event.inputs.target }}
dryrun: ${{ github.event.inputs.dryrun }}
charts_dir: ${{ env.CHARTS_DIR }}

0 comments on commit feafdaf

Please sign in to comment.