Skip to content

branch sync

branch sync #575

Workflow file for this run

name: branch sync
on:
workflow_dispatch:
schedule:
- cron: '30 2 * * *'
jobs:
prepare:
if: vars.ENABLE_BRANCH_SYNC == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ng
path: mcpelauncher-ng
submodules: true
- uses: actions/checkout@v3
with:
ref: qt6
path: mcpelauncher-qt6
submodules: true
- name: Update branches
run: |
set -x
dirs=( "mcpelauncher-ng" "mcpelauncher-qt6" )
common_submodules=( "logger" "base64" "file-util" "properties-parser" "simple-ipc" "daemon-utils" "msa-daemon-client" "eglut" "linux-gamepad" "game-window" "file-picker" "cll-telemetry" "minecraft-imported-symbols" "mcpelauncher-common" "mcpelauncher-core" "mcpelauncher-client" "arg-parser" "mcpelauncher-linux-bin" "epoll-shim" "osx-elf-header" "mcpelauncher-mac-bin" "android-support-headers" "libc-shim" "mcpelauncher-linker" "libjnivm" "sdl3" "imgui" )
# ui_submodules=("mcpelauncher-webview" "mcpelauncher-errorwindow")
for dir in "${dirs[@]}"
do
pushd "$dir"
# from https://github.com/orgs/community/discussions/26560
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
for submodule in "${common_submodules[@]}"
do
git -C "$submodule" fetch origin HEAD
git -C "$submodule" reset --hard FETCH_HEAD
done
git add . && git commit -m "Branch Sync" || (echo "Nothing to do" && exit 0)
git push origin "HEAD:refs/heads/branch-sync-$dir" -f
echo "$dir=$(git rev-parse HEAD)" >> $GITHUB_ENV
popd
done
shell: bash
outputs:
mcpelauncher-ng: ${{ env.mcpelauncher-ng }}
mcpelauncher-qt6: ${{ env.mcpelauncher-qt6 }}
sync: ${{ env.mcpelauncher-ng && env.mcpelauncher-qt6 && 'true' || 'false' }}
linux-AppImage:
if: needs.prepare.outputs.sync == 'true'
needs: prepare
uses: minecraft-linux/appimage-builder/.github/workflows/main.yml@main
with:
mcpelauncher-ref: ${{ needs.prepare.outputs.mcpelauncher-ng }}
mcpelauncher-qt6-ref: ${{ needs.prepare.outputs.mcpelauncher-qt6 }}
update-information: https://github.com/minecraft-linux/mcpelauncher-manifest/releases/download/nightly
# We use a single tag in this distribution matching the location of the zsync file
tag-name: "-"
linux-AppImage-sdl3:
if: needs.prepare.outputs.sync == 'true'
needs: prepare
uses: minecraft-linux/appimage-builder/.github/workflows/main.yml@main
with:
mcpelauncher-ref: ${{ needs.prepare.outputs.mcpelauncher-ng }}
mcpelauncher-qt6-ref: ${{ needs.prepare.outputs.mcpelauncher-qt6 }}
update-information: https://github.com/minecraft-linux/mcpelauncher-manifest/releases/download/nightly
# We use a single tag in this distribution matching the location of the zsync file
tag-name: "-"
suffix: "-sdl3"
appImageFlags: |-
-l -DGAMEWINDOW_SYSTEM=SDL3 -l -DSDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS=1
macOS:
if: needs.prepare.outputs.sync == 'true'
needs: prepare
uses: minecraft-linux/macos-builder/.github/workflows/main.yml@main
with:
mcpelauncher-ref: ${{ needs.prepare.outputs.mcpelauncher-ng }}
secrets: inherit
linux-pkg:
if: needs.prepare.outputs.sync == 'true'
needs: prepare
uses: minecraft-linux/pkg/.github/workflows/build-linux.yml@main
with:
shas: |-
{
"mcpelauncher-manifest": {
"": ${{ tojson(needs.prepare.outputs.mcpelauncher-ng) }},
"qt6": ${{ tojson(needs.prepare.outputs.mcpelauncher-qt6) }}
}
}
deploy:
if: needs.prepare.outputs.sync == 'true' && !failure('macOS', 'linux-pkg') && !cancelled()
needs:
- prepare
- linux-AppImage
- linux-AppImage-sdl3
- macOS
- linux-pkg
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ng
path: mcpelauncher-ng
- uses: actions/checkout@v3
with:
ref: qt6
path: mcpelauncher-qt6
- name: Update branches
run: |
# from https://github.com/orgs/community/discussions/26560
git -C mcpelauncher-ng config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git -C mcpelauncher-ng config user.name "github-actions[bot]"
git -C mcpelauncher-qt6 config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git -C mcpelauncher-qt6 config user.name "github-actions[bot]"
git -C mcpelauncher-ng fetch origin ${{ needs.prepare.outputs.mcpelauncher-ng }}
git -C mcpelauncher-ng push origin ${{ needs.prepare.outputs.mcpelauncher-ng }}:ng
git -C mcpelauncher-ng push origin ${{ needs.prepare.outputs.mcpelauncher-ng }}:refs/tags/nightly -f
git -C mcpelauncher-qt6 fetch origin ${{ needs.prepare.outputs.mcpelauncher-qt6 }}
git -C mcpelauncher-qt6 push origin ${{ needs.prepare.outputs.mcpelauncher-qt6 }}:qt6
shell: bash
publish:
needs: deploy
# this should also run if linux packages fail, since we don't upload those anyway
if: needs.prepare.outputs.sync == 'true' && !failure('macOS') && !cancelled()
permissions: write-all
runs-on: ubuntu-latest
env:
LAUNCHER_RELEASE_DESCRIPTION: |
This release appends assets every day, the one with the highest number is the latest one.
Please use releases from https://mcpelauncher.readthedocs.io/.
Builds from this tag are very very unstable, but new changes lands here earlier.
**The macOS binaries provided here don't support the builtin updater, you risk falling behind updates while using a nightly**
steps:
- uses: actions/checkout@v3
- name: Setup Vars
id: setup-vars
uses: actions/github-script@v6
with:
script: |
core.setOutput("owner", context.repo.owner)
core.setOutput("repo", context.repo.repo)
- name: Download Everything
uses: actions/download-artifact@v4
with:
path: output
pattern: +(appimage|dmg)-*
merge-multiple: true
- name: Download ghr
run: |
curl -L https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz --output ghr.tar.gz
tar -xf ghr.tar.gz
- name: Upload Nightly
run: |
./ghr*/ghr -t ${{ secrets.GITHUB_TOKEN }} -u ${{ steps.setup-vars.outputs.owner }} -r ${{ steps.setup-vars.outputs.repo }} -b "$LAUNCHER_RELEASE_DESCRIPTION" -replace "nightly" output/
- name: Update Quick Links
run: |
for file in *; do
LAUNCHER_RELEASE_DESCRIPTION="$LAUNCHER_RELEASE_DESCRIPTION- [$file](${{ github.server_url }}/${{ steps.setup-vars.outputs.owner }}/${{ steps.setup-vars.outputs.repo }}/releases/download/nightly/$file)
"
done
gh release edit nightly --notes "$LAUNCHER_RELEASE_DESCRIPTION"
working-directory: output
env:
GH_TOKEN: ${{ github.token }}
continue-on-error: true