ci: adding job to sync master with release branches (#156) #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Master to Release Branch | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| sync_master_to_release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "GitHub Actions Bot" | |
| git config user.email "[email protected]" | |
| - name: Merge master into release | |
| run: | | |
| BRANCH_NAME="redhat-3.15" | |
| echo "Syncing master to $BRANCH_NAME" | |
| git checkout master | |
| git pull origin master | |
| MASTER_COMMIT=$(git rev-parse HEAD) | |
| git fetch origin $BRANCH_NAME | |
| git checkout $BRANCH_NAME | |
| git pull origin $BRANCH_NAME | |
| RELEASE_COMMIT=$(git rev-parse HEAD) | |
| echo "Rebasing $BRANCH_NAME ($RELEASE_COMMIT) onto master ($MASTER_COMMIT)" | |
| git rebase master | |
| git push origin $BRANCH_NAME | |
| echo "Merged master ($MASTER_COMMIT) into $BRANCH_NAME ($RELEASE_COMMIT)" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |