Split ios-release in separate workflow (#4062)
This commit is contained in:
188
.github/workflows/ios-ci.yml
vendored
188
.github/workflows/ios-ci.yml
vendored
@@ -2,19 +2,6 @@ name: ios-ci
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release:
|
||||
type: choice
|
||||
default: no
|
||||
options:
|
||||
- full
|
||||
- pre
|
||||
- no
|
||||
description: Whether to make a release, choose full release (uses platform/ios/VERSION) or pre-release
|
||||
pre_release_version:
|
||||
type: string
|
||||
default: ''
|
||||
description: Version (only for pre-releases)
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
@@ -28,9 +15,6 @@ on:
|
||||
|
||||
permissions:
|
||||
id-token: write # needed for AWS
|
||||
contents: write # allow making a release
|
||||
actions: write # for triggering ios-release-cocoapods.yml
|
||||
issues: write # for notify-release-on-prs.ts
|
||||
|
||||
jobs:
|
||||
pre_job:
|
||||
@@ -221,178 +205,6 @@ jobs:
|
||||
run: |
|
||||
HOSTING_BASE_PATH="maplibre-native/ios/latest" platform/ios/scripts/docc.sh
|
||||
|
||||
ios-release:
|
||||
runs-on: macos-14
|
||||
needs: ios-build
|
||||
if: github.ref == 'refs/heads/main' || github.event.inputs.release == 'pre'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: platform/ios
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: VERSION file changed
|
||||
id: version-file-ios-changed
|
||||
uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1
|
||||
with:
|
||||
files: platform/ios/VERSION
|
||||
|
||||
# Make Metal XCFramework release
|
||||
- name: Should make release?
|
||||
if: |
|
||||
github.event.inputs.release == 'full' || github.event.inputs.release == 'pre' ||
|
||||
(github.event_name == 'push' && steps.version-file-ios-changed.outputs.any_changed == 'true')
|
||||
run: echo make_release=true >> "$GITHUB_ENV"
|
||||
|
||||
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v4
|
||||
if: env.make_release
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
- name: Build XCFramework (Dynamic)
|
||||
if: env.make_release
|
||||
run: |
|
||||
bazel build --compilation_mode=opt --features=dead_strip,thin_lto --objc_enable_binary_stripping \
|
||||
--apple_generate_dsym --output_groups=+dsyms --//:renderer=metal //platform/ios:MapLibre.dynamic --embed_label=maplibre_ios_"$(cat VERSION)"
|
||||
echo xcframework="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal //platform/ios:MapLibre.dynamic)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build XCFramework (Static)
|
||||
# for now, just build it TODO: make a static framework release
|
||||
run: |
|
||||
bazel build //platform/ios:MapLibre.static --//:renderer=metal --compilation_mode="opt" --copt -g --copt="-Oz" --strip never --output_groups=+dsyms --apple_generate_dsym
|
||||
echo xcframework_static="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal //platform/ios:MapLibre.static)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Create .zip with debug symbols
|
||||
if: env.make_release
|
||||
working-directory: ./bazel-bin/platform/ios/MapLibre.dynamic_dsyms
|
||||
run: |
|
||||
zip MapLibre_ios_device.framework.dSYM.zip MapLibre_ios_device.framework.dSYM/Contents/Resources/DWARF/MapLibre_ios_device MapLibre_ios_device.framework.dSYM/Contents/Info.plist
|
||||
echo debug_symbols_ios="$(realpath MapLibre_ios_device.framework.dSYM.zip)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Get version (release)
|
||||
if: github.event.inputs.release == 'full' || steps.version-file-ios-changed.outputs.any_changed == 'true'
|
||||
run: |
|
||||
echo version="$(head VERSION)" >> "$GITHUB_ENV"
|
||||
echo changelog_version_heading="## $(head 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 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: Extract changelog for version
|
||||
if: env.make_release
|
||||
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: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v4
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
|
||||
role-session-name: ${{ github.run_id }}
|
||||
|
||||
- name: Upload changelog to S3
|
||||
if: env.make_release
|
||||
run: aws s3 cp changelog_for_version.md s3://maplibre-native/changelogs/ios-${{ env.version }}.md
|
||||
|
||||
- name: Create tag
|
||||
if: env.make_release
|
||||
run: |
|
||||
git tag -a ios-v${{ env.version }} -m "Publish ios-v${{ env.version }}" ${{ github.sha }}
|
||||
git push origin ios-v${{ env.version }}
|
||||
|
||||
- name: Add license to XCFramework zip
|
||||
if: env.make_release
|
||||
run: |
|
||||
cp ${{ env.xcframework }} MapLibre.dynamic.xcframework.zip
|
||||
cp ${{ env.xcframework_static }} MapLibre.static.xcframework.zip
|
||||
chmod +w MapLibre.dynamic.xcframework.zip
|
||||
chmod +w MapLibre.static.xcframework.zip
|
||||
zip MapLibre.dynamic.xcframework.zip LICENSE.md # add license to zip
|
||||
zip MapLibre.static.xcframework.zip LICENSE.md # add license to zip
|
||||
working-directory: .
|
||||
|
||||
- name: Release (GitHub) - Create Draft
|
||||
if: env.make_release
|
||||
id: github_release
|
||||
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
|
||||
with:
|
||||
name: ios-v${{ env.version }}
|
||||
files: |
|
||||
MapLibre.dynamic.xcframework.zip
|
||||
MapLibre.static.xcframework.zip
|
||||
${{ env.debug_symbols_ios }}
|
||||
tag_name: ios-v${{ env.version }}
|
||||
prerelease: ${{ github.event.inputs.release == 'pre' }}
|
||||
body_path: platform/ios/changelog_for_version.md
|
||||
fail_on_unmatched_files: true
|
||||
draft: true
|
||||
|
||||
# needed to trigger workflow for Swift Package Index release
|
||||
- name: Generate token
|
||||
if: env.make_release
|
||||
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
||||
id: generate_token
|
||||
with:
|
||||
app-id: ${{ secrets.MAPLIBRE_NATIVE_BOT_APP_ID }}
|
||||
private-key: ${{ secrets.MAPLIBRE_NATIVE_BOT_PRIVATE_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
|
||||
- name: Release (Swift Package Index)
|
||||
if: env.make_release
|
||||
run: |
|
||||
echo "::add-mask::${{ steps.generate_token.outputs.token }}"
|
||||
release_workflow_id=81221759 # id of release.yml
|
||||
curl -L \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: token ${{ steps.generate_token.outputs.token }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
https://api.github.com/repos/maplibre/maplibre-gl-native-distribution/actions/workflows/$release_workflow_id/dispatches \
|
||||
-d '{"ref":"main","inputs":{
|
||||
"changelog_url": "https://maplibre-native.s3.eu-central-1.amazonaws.com/changelogs/ios-${{ env.version }}.md",
|
||||
"version":"${{ env.version }}",
|
||||
"download_url": "https://github.com/maplibre/maplibre-native/releases/download/ios-v${{ env.version }}/MapLibre.dynamic.xcframework.zip"}}'
|
||||
|
||||
- run: npm install
|
||||
working-directory: .
|
||||
|
||||
- name: Release (CocoaPods)
|
||||
shell: bash -leo pipefail {0} # so pod is found
|
||||
if: env.make_release
|
||||
run: gh workflow run ios-release-cocoapods.yml --field version=${{ env.version }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Publish release (remove draft)
|
||||
if: env.make_release
|
||||
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
|
||||
with:
|
||||
tag_name: ios-v${{ env.version }}
|
||||
name: ios-v${{ env.version }}
|
||||
draft: false
|
||||
|
||||
- name: Write release notifications
|
||||
if: env.make_release && github.repository_owner == 'maplibre'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: node .github/scripts/notify-release-on-prs.ts --tag ios-v${{ env.version }}
|
||||
working-directory: .
|
||||
|
||||
ios-build-cmake:
|
||||
needs: pre_job
|
||||
runs-on: macos-14
|
||||
|
||||
168
.github/workflows/ios-release.yml
vendored
Normal file
168
.github/workflows/ios-release.yml
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
name: ios-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) or pre-release
|
||||
pre_release_version:
|
||||
type: string
|
||||
default: ''
|
||||
description: Version (only for pre-releases)
|
||||
|
||||
permissions:
|
||||
id-token: write # needed for AWS
|
||||
contents: write # allow making a release
|
||||
actions: write # for triggering ios-release-cocoapods.yml
|
||||
issues: write # for notify-release-on-prs.ts
|
||||
|
||||
jobs:
|
||||
ios-release:
|
||||
runs-on: macos-14
|
||||
defaults:
|
||||
run:
|
||||
working-directory: platform/ios
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v4
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
- name: Create tag
|
||||
run: |
|
||||
git tag -a ios-v${{ env.version }} -m "Publish ios-v${{ env.version }}" ${{ github.sha }}
|
||||
git push origin ios-v${{ env.version }}
|
||||
|
||||
- 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/ios:MapLibre.dynamic --embed_label=maplibre_ios_"$(cat VERSION)"
|
||||
echo xcframework="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal //platform/ios:MapLibre.dynamic)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build XCFramework (Static)
|
||||
# for now, just build it TODO: make a static framework release
|
||||
run: |
|
||||
bazel build //platform/ios:MapLibre.static --//:renderer=metal --compilation_mode="opt" --copt -g --copt="-Oz" --strip never --output_groups=+dsyms --apple_generate_dsym
|
||||
echo xcframework_static="$(bazel info execution_root)"/"$(bazel cquery --output=files --compilation_mode=opt --//:renderer=metal //platform/ios:MapLibre.static)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Create .zip with debug symbols
|
||||
working-directory: ./bazel-bin/platform/ios/MapLibre.dynamic_dsyms
|
||||
run: |
|
||||
zip MapLibre_ios_device.framework.dSYM.zip MapLibre_ios_device.framework.dSYM/Contents/Resources/DWARF/MapLibre_ios_device MapLibre_ios_device.framework.dSYM/Contents/Info.plist
|
||||
echo debug_symbols_ios="$(realpath MapLibre_ios_device.framework.dSYM.zip)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Get version (release)
|
||||
if: github.event.inputs.release == 'full'
|
||||
run: |
|
||||
echo version="$(head VERSION)" >> "$GITHUB_ENV"
|
||||
echo changelog_version_heading="## $(head 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 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: 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: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v4
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ vars.OIDC_AWS_ROLE_TO_ASSUME }}
|
||||
role-session-name: ${{ github.run_id }}
|
||||
|
||||
- name: Upload changelog to S3
|
||||
run: aws s3 cp changelog_for_version.md s3://maplibre-native/changelogs/ios-${{ env.version }}.md
|
||||
|
||||
- name: Add license to XCFramework zip
|
||||
run: |
|
||||
cp ${{ env.xcframework }} MapLibre.dynamic.xcframework.zip
|
||||
cp ${{ env.xcframework_static }} MapLibre.static.xcframework.zip
|
||||
chmod +w MapLibre.dynamic.xcframework.zip
|
||||
chmod +w MapLibre.static.xcframework.zip
|
||||
zip MapLibre.dynamic.xcframework.zip LICENSE.md # add license to zip
|
||||
zip MapLibre.static.xcframework.zip LICENSE.md # add license to zip
|
||||
working-directory: .
|
||||
|
||||
- name: Release (GitHub) - Create Draft
|
||||
id: github_release
|
||||
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
|
||||
with:
|
||||
name: ios-v${{ env.version }}
|
||||
files: |
|
||||
MapLibre.dynamic.xcframework.zip
|
||||
MapLibre.static.xcframework.zip
|
||||
${{ env.debug_symbols_ios }}
|
||||
tag_name: ios-v${{ env.version }}
|
||||
prerelease: ${{ github.event.inputs.release == 'pre' }}
|
||||
body_path: platform/ios/changelog_for_version.md
|
||||
fail_on_unmatched_files: true
|
||||
draft: true
|
||||
|
||||
# needed to trigger workflow for Swift Package Index release
|
||||
- name: Generate token
|
||||
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
||||
id: generate_token
|
||||
with:
|
||||
app-id: ${{ secrets.MAPLIBRE_NATIVE_BOT_APP_ID }}
|
||||
private-key: ${{ secrets.MAPLIBRE_NATIVE_BOT_PRIVATE_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
|
||||
- name: Release (Swift Package Index)
|
||||
run: |
|
||||
echo "::add-mask::${{ steps.generate_token.outputs.token }}"
|
||||
release_workflow_id=81221759 # id of release.yml
|
||||
curl -L \
|
||||
-X POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: token ${{ steps.generate_token.outputs.token }}" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
https://api.github.com/repos/maplibre/maplibre-gl-native-distribution/actions/workflows/$release_workflow_id/dispatches \
|
||||
-d '{"ref":"main","inputs":{
|
||||
"changelog_url": "https://maplibre-native.s3.eu-central-1.amazonaws.com/changelogs/ios-${{ env.version }}.md",
|
||||
"version":"${{ env.version }}",
|
||||
"download_url": "https://github.com/maplibre/maplibre-native/releases/download/ios-v${{ env.version }}/MapLibre.dynamic.xcframework.zip"}}'
|
||||
|
||||
- run: npm install
|
||||
working-directory: .
|
||||
|
||||
- name: Release (CocoaPods)
|
||||
shell: bash -leo pipefail {0} # so pod is found
|
||||
run: gh workflow run ios-release-cocoapods.yml --field version=${{ env.version }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Publish release (remove draft)
|
||||
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
|
||||
with:
|
||||
tag_name: ios-v${{ env.version }}
|
||||
name: ios-v${{ env.version }}
|
||||
draft: false
|
||||
|
||||
- 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 ios-v${{ env.version }}
|
||||
working-directory: .
|
||||
Reference in New Issue
Block a user