Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport updated backport workflow [5.4] #1471

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/workflows/backport-5-0.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/backport-5-1.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/backport-5-2.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/backport-5-3.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/backport-5-4-beta-2.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/backport-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Backport changes

on:
workflow_call:
inputs:
label-to-check-for:
required: true
type: string
target-branch:
required: true
type: string

jobs:
backport:
runs-on: ubuntu-latest

steps:
- name: Check PR for backport label
id: check_pr_labels
uses: shioyang/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ inputs.label-to-check-for }}

- name: See result
if: runner.debug == '1'
run: echo "${{ steps.check_pr_labels.outputs.result }}"

- name: Checkout repository
if: ${{ steps.check_pr_labels.outputs.result == 'true' }}
uses: actions/checkout@v4
with:
# ensure the backport target branch is checked out, too
fetch-depth: 0

- if: ${{ steps.check_pr_labels.outputs.result == 'true' }}
uses: hazelcast/backport/.github/actions/backport@master
with:
GITHUB_TOKEN: ${{ github.token }}
TARGET_BRANCH: ${{ inputs.target-branch }}
REF_TO_BACKPORT: ${{ github.sha }}
BACKPORT_OPTIONS: --omit-labels
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 all maintenance branches
name: Backport changes to maintenance branches
on:
push:
branches:
- main
jobs:
backport:
strategy:
matrix:
branch: ['v/5.0', 'v/5.1', 'v/5.2', 'v/5.3']
get-maintenance-branches:
runs-on: ubuntu-latest
outputs:
branches: "['5.3', '5.4', '5.5']"
steps:

- name: checkout
uses: actions/[email protected]
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 to all versions"]'

- 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: ./.github/workflows/backport-workflow.yml
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: ./.github/workflows/backport-workflow.yml
with:
label-to-check-for: '["backport to ${{ matrix.branch }}"]'
target-branch: v/${{ matrix.branch }}
secrets: inherit
38 changes: 5 additions & 33 deletions .github/workflows/forwardport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,8 @@ on:
- v/*
jobs:
forwardport:
strategy:
matrix:
branch: ['main']
runs-on: ubuntu-latest
steps:

- name: checkout
uses: actions/[email protected]
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 forwardport label
id: check_pr_labels
uses: shioyang/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
labels: '["forwardport to snapshot"]'

- name: See result
run: echo "${{ steps.check_pr_labels.outputs.result }}"

- name: Checkout 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: ./.github/workflows/backport-workflow.yml
with:
label: '["forwardport to snapshot"]'
target-branch: main
secrets: inherit
Loading