-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build on each XCode version available on the runner
- Loading branch information
Showing
6 changed files
with
172 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build Library XcFramework and attach it and its checksum to the requested release | ||
description: Only if it is not attached already | ||
inputs: | ||
target: | ||
description: The release to attach to | ||
required: true | ||
xcodeversion: | ||
description: The Xcode version to configure before compiling | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- run: | | ||
curl -ILs --fail https://github.com/$GITHUB_REPOSITORY/releases/download/${{ inputs.target }}/Library-${{ inputs.target }}-xcodebuild-${{ inputs.xcodeversion }}.xcframework.zip | ||
echo ATTACHMENT_FOUND=$? >> $GITHUB_ENV | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
uses: actions/checkout@v3.5.3 | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
uses: maxim-lobanov/setup-xcode@v1.6.0 | ||
with: | ||
xcode-version: ${{ inputs.xcodeversion }} | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
uses: ./.github/actions/runGradleTask | ||
with: | ||
task: :library:assembleLibraryReleaseXCFramework | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
run: zip -r Library.xcframework.zip library/build/XCFrameworks/release/library.xcframework | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
uses: actions/download-artifact@v4.1.4 | ||
with: | ||
name: upload_url | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
run: echo UPLOAD_URL=$(cat upload_url | sed "s/{?name,label}/?name=Library-${{ inputs.target }}-xcodebuild-${{ inputs.xcodeversion }}.xcframework.zip/") >> $GITHUB_ENV | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
run: | | ||
curl -s \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-H "Content-Type: application/octet-stream" \ | ||
--data-binary "@Library.xcframework.zip" \ | ||
$UPLOAD_URL | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
run: echo $(swift package compute-checksum Library.xcframework.zip) > checksum | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
run: echo UPLOAD_URL=$(cat upload_url | sed "s/{?name,label}/?name=Library-${{ inputs.target }}-xcodebuild-${{ matrix.xcodeversion }}.xcframework.zip.checksum/") >> $GITHUB_ENV | ||
- if: ${{ env.ATTACHMENT_FOUND != '0' }} | ||
run: | | ||
curl -s \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-H "Content-Type: application/octet-stream" \ | ||
--data-binary "@checksum" \ | ||
$UPLOAD_URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Compile and attach latest release with all targets | ||
on: | ||
schedule: | ||
- cron: '* * * * 5' | ||
permissions: | ||
contents: write | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
jobs: | ||
lookup-latest-github-release: | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
target: ${{ steps.lookup.outputs.target }} | ||
steps: | ||
- id: lookup | ||
run: | | ||
echo "target=$(curl -L \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq --raw-output '.name')" >> $GITHUB_OUTPUT | ||
generate-build-matrix: | ||
runs-on: macos-14-xlarge | ||
outputs: | ||
xcodeversions: ${{ steps.generate.outputs.xcodeversions }} | ||
steps: | ||
- id: generate | ||
run: | | ||
version_list=() | ||
for XCODE_INSTALL in $(ls /Applications | grep Xcode); do | ||
version_list+=("$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" /Applications/$XCODE_INSTALL/Contents/Info.plist)") | ||
done | ||
unique_version_list=( $(printf "%s\n" ${version_list[@]} | sort -n -u) ) | ||
jsonString="$(jq -c --null-input '$ARGS.positional' --args -- "${unique_version_list[@]}")" | ||
echo "xcodeversions=$jsonString" >> $GITHUB_OUTPUT | ||
attach-xcframework-to-github-release: | ||
runs-on: macos-14-xlarge | ||
needs: [ lookup-latest-github-release, generate-build-matrix ] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
xcodeversion: ${{ fromJSON(needs.generate-build-matrix.outputs.xcodeversions) }} | ||
steps: | ||
- uses: ./.github/actions/attachXcFrameworkAndChecksum | ||
with: | ||
target: ${{ needs.lookup-latest-github-release.outputs.target }} | ||
xcodeversion: ${{ matrix.xcodeversion }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters