diff --git a/.github/workflows/backport-starting-v511.yml b/.github/workflows/backport-starting-v511.yml index bac975d0..0dfabd52 100644 --- a/.github/workflows/backport-starting-v511.yml +++ b/.github/workflows/backport-starting-v511.yml @@ -6,35 +6,11 @@ on: jobs: backport: strategy: + fail-fast: false matrix: branch: ['v/5.11','v/5.12','v/5.13','v/5.14'] - runs-on: ubuntu-latest - steps: - - - name: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up git config - run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" - - - name: Check PR for backport label - id: check_pr_labels - uses: shioyang/check-pr-labels-on-push-action@v1.0.12 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - labels: '["backport starting from 5.11"]' - - - name: See result - run: echo "${{ steps.check_pr_labels.outputs.result }}" - - - name: Checkout maintenance branch and cherry-pick - if: ${{ steps.check_pr_labels.outputs.result == 'true' }} - run: | - git fetch - git checkout ${{ matrix.branch }} - git cherry-pick -x --strategy=recursive -X theirs $GITHUB_SHA - git push + uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main + with: + label-to-check-for: '["backport starting from 5.11"]' + target-branch: v/${{ matrix.branch }} + secrets: inherit diff --git a/.github/workflows/backport-v511.yml b/.github/workflows/backport-v511.yml deleted file mode 100644 index 32f1c720..00000000 --- a/.github/workflows/backport-v511.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Backport changes to 5.11 branch -on: - push: - branches: - - main -jobs: - backport: - strategy: - matrix: - branch: ['v/5.11'] - runs-on: ubuntu-latest - steps: - - - name: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up git config - run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" - - - name: Check PR for backport label - id: check_pr_labels - uses: shioyang/check-pr-labels-on-push-action@v1.0.12 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - labels: '["backport to 5.11"]' - - - name: See result - run: echo "${{ steps.check_pr_labels.outputs.result }}" - - - name: Checkout maintenance branch and cherry-pick - if: ${{ steps.check_pr_labels.outputs.result == 'true' }} - run: | - git fetch - git checkout ${{ matrix.branch }} - git cherry-pick -x --strategy=recursive -X theirs $GITHUB_SHA - git push diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index e14b020c..8eaf3379 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -4,37 +4,33 @@ on: branches: - main jobs: - backport: - strategy: - matrix: - branch: ['v/5.8', 'v/5.9', 'v/5.10'] + get-maintenance-branches: runs-on: ubuntu-latest + outputs: + branches: "['5.8', '5.9', '5.10', '5.11', '5.12', '5.13', '5.14']" steps: - - - name: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - run: exit 0 - - name: Set up git config - run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" - - - name: Check PR for backport label - id: check_pr_labels - uses: shioyang/check-pr-labels-on-push-action@v1.0.12 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - labels: '["backport"]' - - - name: See result - run: echo "${{ steps.check_pr_labels.outputs.result }}" + backport-to-all-branch: + needs: get-maintenance-branches + strategy: + fail-fast: false + matrix: + branch: ${{ fromJSON(needs.get-maintenance-branches.outputs.branches) }} + uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main + with: + label-to-check-for: '["backport to all versions"]' + target-branch: v/${{ matrix.branch }} + secrets: inherit - - name: Checkout maintenance branch and cherry-pick - if: ${{ steps.check_pr_labels.outputs.result == 'true' }} - run: | - git fetch - git checkout ${{ matrix.branch }} - git cherry-pick -x --strategy=recursive -X theirs $GITHUB_SHA - git push + backport-to-specified-branch: + needs: get-maintenance-branches + strategy: + fail-fast: false + matrix: + branch: ${{ fromJSON(needs.get-maintenance-branches.outputs.branches) }} + uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main + with: + label-to-check-for: '["backport to ${{ matrix.branch }}"]' + target-branch: v/${{ matrix.branch }} + secrets: inherit