Skip to content

Commit

Permalink
Externalise backport action
Browse files Browse the repository at this point in the history
The back porting logic is integrated into each action, duplicated [many times across the codebase](https://github.com/search?q=org%3Ahazelcast+%22Checkout+maintenance+branch+and+cherry-pick%22&type=code).

In hazelcast/hz-docs#1373 this was centralised.

- updated actions to use it
- simplified actions
- updated the list of supported maintenance branches
   - *note* this was very outdated
  • Loading branch information
JackPGreen authored Nov 13, 2024
1 parent 7fca512 commit 565b540
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 71 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/backport-v511.yml

This file was deleted.

58 changes: 27 additions & 31 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
name: Backport changes to maintenance branches
name: Backport changes to all maintenance branches
on:
push:
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/[email protected]
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: true
matrix:
branch: ${{ fromJSON(needs.get-maintenance-branches.outputs.branches) }}
uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main
with:
label: '["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: true
matrix:
branch: ${{ fromJSON(needs.get-maintenance-branches.outputs.branches) }}
uses: hazelcast/hz-docs/.github/workflows/backport-workflow.yml@main
with:
label: '["backport to ${{ matrix.branch }}"]'
target-branch: v/${{ matrix.branch }}
secrets: inherit

0 comments on commit 565b540

Please sign in to comment.