From 93d484456a20b05071171956dec6098d57c73ee5 Mon Sep 17 00:00:00 2001 From: Florian Herzog <53746469+fonok3@users.noreply.github.com> Date: Fri, 17 Jul 2026 12:17:36 +0200 Subject: [PATCH] macos: add release workflow for GitHub Releases (#4242) Co-authored-by: Bart Louwers --- .github/scripts/notify-release-on-prs.ts | 2 + .github/workflows/macos-release.yml | 184 +++++++++++++++++++++++ platform/macos/CHANGELOG.md | 8 +- 3 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/macos-release.yml diff --git a/.github/scripts/notify-release-on-prs.ts b/.github/scripts/notify-release-on-prs.ts index 2ef403273..5679ed80c 100644 --- a/.github/scripts/notify-release-on-prs.ts +++ b/.github/scripts/notify-release-on-prs.ts @@ -74,6 +74,8 @@ async function createOrUpdateReleaseNotification({ return `MapLibre iOS ${version}`; } else if (platform === 'android') { return `MapLibre Android ${version}`; + } else if (platform === 'macos') { + return `MapLibre macOS ${version}`; } return tag; } diff --git a/.github/workflows/macos-release.yml b/.github/workflows/macos-release.yml new file mode 100644 index 000000000..677778e81 --- /dev/null +++ b/.github/workflows/macos-release.yml @@ -0,0 +1,184 @@ +name: macos-release + +on: + workflow_dispatch: + inputs: + release: + type: choice + default: full + options: + - full + - pre + description: Whether to make a release, choose full release (uses platform/ios/VERSION, shared with iOS) or pre-release + pre_release_version: + type: string + default: '' + description: Version (only for pre-releases) + +jobs: + macos-build-dynamic: + runs-on: macos-14 + defaults: + run: + working-directory: platform/macos + shell: bash + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 + with: + submodules: recursive + + - name: Install dependencies + run: brew install webp libuv + + - name: Build XCFramework (Dynamic) + run: | + bazel build --compilation_mode=opt --features=dead_strip,thin_lto --objc_enable_binary_stripping \ + --apple_generate_dsym --output_groups=+dsyms --//:renderer=metal \ + --//platform/macos:macos_loop=cfrunloop \ + //platform/macos:MapLibre.dynamic --embed_label=maplibre_macos_"$(cat ../ios/VERSION)" + echo xcframework="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal --//platform/macos:macos_loop=cfrunloop //platform/macos:MapLibre.dynamic)" >> "$GITHUB_ENV" + + - name: Create .zip with debug symbols + working-directory: ./bazel-bin/platform/macos/MapLibre.dynamic_dsyms + run: | + zip MapLibre_macos_device.framework.dSYM.zip MapLibre_macos_device.framework.dSYM/Contents/Resources/DWARF/MapLibre_macos_device MapLibre_macos_device.framework.dSYM/Contents/Info.plist + echo debug_symbols_macos="$(realpath MapLibre_macos_device.framework.dSYM.zip)" >> "$GITHUB_ENV" + + - name: Copy debug symbols to root + working-directory: . + run: cp ${{ env.debug_symbols_macos }} . + + - name: Add license to XCFramework zip + run: | + cp ${{ env.xcframework }} MapLibre.dynamic.xcframework.zip + chmod +w MapLibre.dynamic.xcframework.zip + zip MapLibre.dynamic.xcframework.zip LICENSE.md + working-directory: . + + - name: Upload artifact + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: xcframework + path: | + MapLibre.dynamic.xcframework.zip + MapLibre_macos_device.framework.dSYM.zip + + macos-build-static: + runs-on: macos-14 + defaults: + run: + working-directory: platform/macos + shell: bash + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 + with: + submodules: recursive + + - name: Install dependencies + run: brew install webp libuv + + - name: Build XCFramework (Static) + run: | + bazel build --compilation_mode=opt --copt -g --copt="-Oz" --strip never \ + --//:renderer=metal --//platform/macos:macos_loop=cfrunloop \ + //platform/macos:MapLibre.static --embed_label=maplibre_macos_"$(cat ../ios/VERSION)" + echo xcframework_static="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal --//platform/macos:macos_loop=cfrunloop //platform/macos:MapLibre.static)" >> "$GITHUB_ENV" + + - name: Add license to XCFramework zip + run: | + cp ${{ env.xcframework_static }} MapLibre.static.xcframework.zip + chmod +w MapLibre.static.xcframework.zip + zip MapLibre.static.xcframework.zip LICENSE.md + working-directory: . + + - name: Upload artifact + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: xcframework-static + path: | + MapLibre.static.xcframework.zip + + macos-release: + permissions: + contents: write + issues: write + runs-on: ubuntu-latest + needs: + - macos-build-dynamic + - macos-build-static + defaults: + run: + working-directory: platform/macos + shell: bash + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4 + with: + submodules: recursive + + - uses: actions/download-artifact@v8 + + - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v4 + with: + node-version-file: ".nvmrc" + + # macOS releases share the iOS version (platform/ios/VERSION) so both + # platforms stay aligned. The changelog stays macOS-specific. + - name: Get version (release) + if: github.event.inputs.release == 'full' + run: | + echo version="$(head ../ios/VERSION)" >> "$GITHUB_ENV" + echo changelog_version_heading="## $(head ../ios/VERSION)" >> "$GITHUB_ENV" + + - name: Get version (pre-release) + if: github.event.inputs.release == 'pre' + run: | + version="${{ github.event.inputs.pre_release_version }}" + if [[ -z "$version" ]]; then + version="$(head ../ios/VERSION)"-pre${{ github.sha }} + fi + if [[ "$version" != *"pre"* ]]; then + echo "::error::Pre-release version must include 'pre' (Current version: $version)" + exit 1 + fi + echo version="$version" >> "$GITHUB_ENV" + echo changelog_version_heading="## main" >> "$GITHUB_ENV" + + - name: Create tag if it does not exist + working-directory: . + run: .github/scripts/ensure-tag.sh macos-v${{ env.version }} ${{ github.sha }} + + - name: Extract changelog for version + run: | + awk '/^##/ { p = 0 }; p == 1 { print }; $0 == "${{ env.changelog_version_heading }}" { p = 1 };' CHANGELOG.md > changelog_for_version.md + cat changelog_for_version.md + + - name: Release (GitHub) - Create Draft + uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 + with: + name: macos-v${{ env.version }} + files: | + xcframework/MapLibre.dynamic.xcframework.zip + xcframework/MapLibre_macos_device.framework.dSYM.zip + xcframework-static/MapLibre.static.xcframework.zip + tag_name: macos-v${{ env.version }} + prerelease: ${{ github.event.inputs.release == 'pre' }} + body_path: platform/macos/changelog_for_version.md + fail_on_unmatched_files: true + draft: true + + - name: Publish release (remove draft) + uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 + with: + tag_name: macos-v${{ env.version }} + name: macos-v${{ env.version }} + draft: false + + - run: npm install + working-directory: . + + - name: Write release notifications + if: github.repository_owner == 'maplibre' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: node .github/scripts/notify-release-on-prs.ts --tag macos-v${{ env.version }} + working-directory: . diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index f77ae13fa..09b9d38b4 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -1,7 +1,13 @@ -# Changelog for Mapbox Maps SDK for macOS +# Changelog for MapLibre Native macOS SDK MapLibre welcomes participation and contributions from everyone. Please read [`Contributing Guide`](https://github.com/maplibre/maplibre-native/blob/main/CONTRIBUTING.md) to get started. +## 6.27.0 + +- First automated native macOS XCFramework release ([#4088](https://github.com/maplibre/maplibre-native/issues/4088)). +- Add Bazel `MapLibre.dynamic` and `MapLibre.static` xcframework targets for macOS ([#4113](https://github.com/maplibre/maplibre-native/pull/4113)). +- Fix Xcode 26 build compatibility ([#4226](https://github.com/maplibre/maplibre-native/pull/4226)). + ## 0.19.1 - September 06, 2021 ### Bug Fixes