From e92cae0f312c49decba1d127bb760758228d24df Mon Sep 17 00:00:00 2001 From: Bart Louwers Date: Thu, 4 Jan 2024 15:28:41 +0100 Subject: [PATCH] Automated release to Swift Package Index (#1993) --- .github/workflows/ios-ci.yml | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml index 3b92b7cc42f..678c1812079 100644 --- a/.github/workflows/ios-ci.yml +++ b/.github/workflows/ios-ci.yml @@ -221,17 +221,46 @@ jobs: 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 + zip MapLibre.dynamic.xcframework.zip LICENSE.md # add license to zip + working-directory: . + - name: Release (GitHub) if: env.make_release - id: release + id: github_release uses: softprops/action-gh-release@v1 with: name: ios-v${{ env.version }} - files: ${{ env.xcframework }} + files: MapLibre.dynamic.xcframework.zip tag_name: ios-v${{ env.version }} prerelease: ${{ !github.event.inputs.release }} fail_on_unmatched_files: true + # needed to trigger workflow for Swift Package Index release + - name: Generate token + if: env.make_release + id: generate_token + uses: tibdex/github-app-token@v2 + with: + app_id: ${{ secrets.MAPLIBRE_NATIVE_BOT_APP_ID }} + private_key: ${{ secrets.MAPLIBRE_NATIVE_BOT_PRIVATE_KEY }} + + - 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":{"version":"${{ env.version }}","download_url":"${{ fromJSON(steps.github_release.outputs.assets)[0].browser_download_url }}"}}' + - name: Release (CocoaPods) shell: bash -leo pipefail {0} # so pod is found if: env.make_release