Skip to content

Commit cde8954

Browse files
authored
ci: adding job to sync main to release branches (#200)
1 parent 7ad5b43 commit cde8954

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/branch-sync.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Sync Main to Release Branch
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
sync_main_to_release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Configure Git
18+
run: |
19+
git config user.name "GitHub Actions Bot"
20+
git config user.email "[email protected]"
21+
22+
- name: Merge main into release
23+
run: |
24+
BRANCH_NAME="mirror-registry-2.0-rhel-8"
25+
echo "Syncing main to $BRANCH_NAME"
26+
git checkout main
27+
git pull origin main
28+
MAIN_COMMIT=$(git rev-parse HEAD)
29+
30+
git fetch origin $BRANCH_NAME
31+
git checkout $BRANCH_NAME
32+
git pull origin $BRANCH_NAME
33+
RELEASE_COMMIT=$(git rev-parse HEAD)
34+
echo "Rebasing $BRANCH_NAME ($RELEASE_COMMIT) onto main ($MAIN_COMMIT)"
35+
git rebase main
36+
git push origin $BRANCH_NAME
37+
38+
echo "Merged main ($MAIN_COMMIT) into $BRANCH_NAME ($RELEASE_COMMIT)"
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)