Skip to content

Commit

Permalink
Automated release to Swift Package Index (#1993)
Browse files Browse the repository at this point in the history
  • Loading branch information
louwers authored Jan 4, 2024
1 parent 9599200 commit e92cae0
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e92cae0

Please sign in to comment.