diff options
Diffstat (limited to '.github/workflows/meshmc-release.yml')
| -rw-r--r-- | .github/workflows/meshmc-release.yml | 84 |
1 files changed, 60 insertions, 24 deletions
diff --git a/.github/workflows/meshmc-release.yml b/.github/workflows/meshmc-release.yml index 9a50e9ca73..c6f06ae2a8 100644 --- a/.github/workflows/meshmc-release.yml +++ b/.github/workflows/meshmc-release.yml @@ -31,17 +31,54 @@ jobs: - name: Checkout uses: actions/checkout@v6 with: - submodules: "true" - path: "MeshMC-source" - - name: Download artifacts + submodules: recursive + + - name: Download build artifacts uses: actions/download-artifact@v8 + - name: Grab and store version run: | - tag_name=$(echo ${{ github.ref }} | grep -oE "[^/]+$") - echo "VERSION=$tag_name" >> $GITHUB_ENV - - name: Package artifacts properly + tag_name=$(echo "${{ github.ref }}" | grep -oE "[^/]+$") + echo "VERSION=$tag_name" >> "$GITHUB_ENV" + + # ── Source tarball preparation ────────────────────────────── + - name: Prepare source tree + id: prepare + run: | + set -euo pipefail + + SRC_STAGE="source-stage" + mkdir -p "$SRC_STAGE" + cp -a meshmc "$SRC_STAGE/meshmc" + + # Bundle handbook docs + if [ -d "docs/handbook/meshmc" ]; then + mkdir -p "$SRC_STAGE/meshmc/docs/handbook" + cp -a docs/handbook/meshmc/. "$SRC_STAGE/meshmc/docs/handbook/" + fi + + # Bundle libnbtplusplus and patch CMakeLists.txt + mkdir -p "$SRC_STAGE/meshmc/libraries/libnbtplusplus" + cp -a libnbtplusplus/. "$SRC_STAGE/meshmc/libraries/libnbtplusplus/" + sed -i "s|add_subdirectory(\${CMAKE_SOURCE_DIR}/../libnbtplusplus libnbtplusplus)|add_subdirectory(libraries/libnbtplusplus)|g" \ + "$SRC_STAGE/meshmc/CMakeLists.txt" + + echo "source-dir=$SRC_STAGE/meshmc" >> "$GITHUB_OUTPUT" + + - name: Package source archives + uses: ./.github/actions/package-source + with: + project: meshmc + version: ${{ env.VERSION }} + source-dir: ${{ steps.prepare.outputs.source-dir }} + output-dir: release-artifacts + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-private-key-id: ${{ secrets.GPG_PRIVATE_KEY_ID }} + + # ── Binary artifact packaging ────────────────────────────── + - name: Package binary artifacts run: | - mv ${{ github.workspace }}/MeshMC-source MeshMC-${{ env.VERSION }} + # shellcheck disable=SC2086,SC2035 mv MeshMC-Linux-Qt6-Portable*/MeshMC-portable.tar.gz MeshMC-Linux-Qt6-Portable-${{ env.VERSION }}.tar.gz mv MeshMC-Linux-aarch64-Qt6-Portable*/MeshMC-portable.tar.gz MeshMC-Linux-aarch64-Qt6-Portable-${{ env.VERSION }}.tar.gz mv MeshMC-*.AppImage/MeshMC-*-x86_64.AppImage MeshMC-Linux-x86_64.AppImage @@ -51,45 +88,44 @@ jobs: mv MeshMC-macOS*/MeshMC.zip MeshMC-macOS-${{ env.VERSION }}.zip mv MeshMC-macOS*/MeshMC.dmg MeshMC-macOS-${{ env.VERSION }}.dmg - tar --exclude='.git' -czf MeshMC-${{ env.VERSION }}.tar.gz MeshMC-${{ env.VERSION }} - for d in MeshMC-Windows-MSVC*; do cd "${d}" || continue - LEGACY="$(echo -n ${d} | grep -o Legacy || true)" - ARM64="$(echo -n ${d} | grep -o arm64 || true)" - INST="$(echo -n ${d} | grep -o Setup || true)" - PORT="$(echo -n ${d} | grep -o Portable || true)" + LEGACY="$(echo -n "${d}" | grep -o Legacy || true)" + ARM64="$(echo -n "${d}" | grep -o arm64 || true)" + INST="$(echo -n "${d}" | grep -o Setup || true)" + PORT="$(echo -n "${d}" | grep -o Portable || true)" NAME="MeshMC-Windows-MSVC" test -z "${LEGACY}" || NAME="${NAME}-Legacy" test -z "${ARM64}" || NAME="${NAME}-arm64" test -z "${PORT}" || NAME="${NAME}-Portable" - test -z "${INST}" || mv MeshMC-*.exe ../${NAME}-Setup-${{ env.VERSION }}.exe - test -n "${INST}" || zip -r -9 "../${NAME}-${{ env.VERSION }}.zip" * + test -z "${INST}" || mv MeshMC-*.exe "../${NAME}-Setup-${{ env.VERSION }}.exe" + test -n "${INST}" || zip -r -9 "../${NAME}-${{ env.VERSION }}.zip" -- * cd .. done for d in MeshMC-Windows-MinGW-w64*; do cd "${d}" || continue - INST="$(echo -n ${d} | grep -o Setup || true)" - PORT="$(echo -n ${d} | grep -o Portable || true)" + INST="$(echo -n "${d}" | grep -o Setup || true)" + PORT="$(echo -n "${d}" | grep -o Portable || true)" NAME="MeshMC-Windows-MinGW-w64" test -z "${PORT}" || NAME="${NAME}-Portable" - test -z "${INST}" || mv MeshMC-*.exe ../${NAME}-Setup-${{ env.VERSION }}.exe - test -n "${INST}" || zip -r -9 "../${NAME}-${{ env.VERSION }}.zip" * + test -z "${INST}" || mv MeshMC-*.exe "../${NAME}-Setup-${{ env.VERSION }}.exe" + test -n "${INST}" || zip -r -9 "../${NAME}-${{ env.VERSION }}.zip" -- * cd .. done for d in MeshMC-Windows-MinGW-arm64*; do cd "${d}" || continue - INST="$(echo -n ${d} | grep -o Setup || true)" - PORT="$(echo -n ${d} | grep -o Portable || true)" + INST="$(echo -n "${d}" | grep -o Setup || true)" + PORT="$(echo -n "${d}" | grep -o Portable || true)" NAME="MeshMC-Windows-MinGW-arm64" test -z "${PORT}" || NAME="${NAME}-Portable" - test -z "${INST}" || mv MeshMC-*.exe ../${NAME}-Setup-${{ env.VERSION }}.exe - test -n "${INST}" || zip -r -9 "../${NAME}-${{ env.VERSION }}.zip" * + test -z "${INST}" || mv MeshMC-*.exe "../${NAME}-Setup-${{ env.VERSION }}.exe" + test -n "${INST}" || zip -r -9 "../${NAME}-${{ env.VERSION }}.zip" -- * cd .. done + # ── Single release creation ──────────────────────────────── - name: Create release id: create_release uses: softprops/action-gh-release@v2 @@ -121,4 +157,4 @@ jobs: MeshMC-Windows-MSVC-Setup-${{ env.VERSION }}.exe MeshMC-macOS-${{ env.VERSION }}.zip MeshMC-macOS-${{ env.VERSION }}.dmg - MeshMC-${{ env.VERSION }}.tar.gz + release-artifacts/* |
