diff --git a/.github/actions/releaser/cr.sh b/.github/actions/releaser/cr.sh index a9ab1db2..e7d92100 100755 --- a/.github/actions/releaser/cr.sh +++ b/.github/actions/releaser/cr.sh @@ -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} @@ -42,8 +44,12 @@ release_charts_inside_folders() { prepare_helm_repo + # shellcheck disable=SC2128 + echo "LOOPING FOLDERS ${folders}" # form list of folders which was changed for folder in "${folders[@]}"; do + echo "PROCESSING FOLDERS ${folder} pwd=$(pwd)" + ls "$charts_dir/$folder/Chart.yaml" [[ ! -f "$charts_dir/$folder/Chart.yaml" ]] && continue print_line_separator local chart_name @@ -52,6 +58,7 @@ release_charts_inside_folders() { chart_name=$(read_chart_name "${charts_dir}/${folder}") chart_version=$(read_chart_version "${charts_dir}/${folder}") + echo "CHECK!!!!!!!! $charts_dir/$folder" echo "Checking if \"$charts_dir/$folder\" has been released to the repo" chart_was_released=$(chart_released "${chart_name}" "${chart_version}") diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 387f7286..c9359607 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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" @@ -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 }}