Skip to content

Sync PocketMine-MP primary branches #10

Sync PocketMine-MP primary branches

Sync PocketMine-MP primary branches #10

name: Sync PocketMine-MP primary branches
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to update'
required: true
type: choice
options:
- minor-next
- major-next
- "*"
jobs:
merge:
name: Sync branches
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/PocketMine-MP # to allow testing on forks without editing the workflow
fetch-depth: 0
ssh-key: ${{ secrets.POCKETMINE_MP_DEPLOY_KEY }}
- name: Set Git config
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Merge "stable" into "minor-next" and push changes
if: contains(fromJSON('["minor-next", "*"]'), github.event.inputs.branch)
run: |
LOWER_BRANCH="stable"
TARGET_BRANCH="minor-next"
git checkout -f "$TARGET_BRANCH"
git pull --no-commit --ff origin "$LOWER_BRANCH"
git commit \
-m "Merge '$LOWER_BRANCH' into '$TARGET_BRANCH'" \
-m "Automatic merge performed by: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
|| true # suppress error in case of fast-forward merge
git push
- name: Merge "minor-next" into "major-next" and push changes
if: contains(fromJSON('["major-next", "*"]'), github.event.inputs.branch)
run: |
LOWER_BRANCH="minor-next"
TARGET_BRANCH="major-next"
git checkout -f "$TARGET_BRANCH"
git pull --no-commit --ff origin "$LOWER_BRANCH"
git commit \
-m "Merge '$LOWER_BRANCH' into '$TARGET_BRANCH'" \
-m "Automatic merge performed by: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
|| true # suppress error in case of fast-forward merge
git push