0.7.1 #10
Workflow file for this run
This file contains hidden or 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
| name: Build XCFramework | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: "Manual build target - use 'release' for production-like behavior (ie when fixing) and 'artifact' for testing" | |
| required: true | |
| type: choice | |
| options: | |
| - artifact # builds only, uploads as a 30-day artifact for testing, does not pollute release assets and does not trigger koog-spm | |
| - release # uploads to GitHub release and triggers koog-spm, must be triggered from a version tag ref | |
| env: | |
| JAVA_VERSION: 17 | |
| JAVA_DISTRIBUTION: 'corretto' | |
| JAVA_OPTS: "-Xms8g -Xmx8g -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Dkotlin.daemon.jvm.options=-Xmx6g" | |
| jobs: | |
| build-xcframework: | |
| name: Build iOS XCFramework | |
| runs-on: macos-latest # Required for Xcode | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: write # Required for uploading release assets | |
| steps: | |
| - name: Configure Git | |
| run: | | |
| git config --global core.autocrlf input | |
| - uses: actions/checkout@v6 | |
| - name: Resolve version and target | |
| id: resolve | |
| run: | | |
| if [ "${{ github.event_name }}" == "release" ]; then | |
| VERSION="${{ github.event.release.tag_name }}" | |
| TARGET="release" | |
| elif [ "${{ inputs.target }}" == "release" ]; then | |
| if [ "${{ github.ref_type }}" != "tag" ]; then | |
| echo "target 'release' requires triggering from a tag ref, not a branch" >&2 | |
| exit 1 | |
| fi | |
| VERSION="${{ github.ref_name }}" | |
| TARGET="release" | |
| else | |
| VERSION="${{ github.sha }}" | |
| TARGET="artifact" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "target=$TARGET" >> $GITHUB_OUTPUT | |
| echo "Using version: $VERSION, target: $TARGET" | |
| - name: Verify koog-spm app credentials | |
| if: steps.resolve.outputs.target == 'release' | |
| run: | | |
| if [ -z "${{ vars.KOOG_SPM_APP_ID }}" ]; then | |
| echo "KOOG_SPM_APP_ID is required for release dispatch but is not set." >&2 | |
| exit 1 | |
| fi | |
| if [ -z "${{ secrets.KOOG_SPM_APP_KEY }}" ]; then | |
| echo "KOOG_SPM_APP_KEY is required for release dispatch but is not set." >&2 | |
| exit 1 | |
| fi | |
| - name: Generate koog-spm app token | |
| if: steps.resolve.outputs.target == 'release' | |
| id: app-token | |
| uses: actions/create-github-app-token@v1 | |
| env: | |
| PRIVATE_KEY: ${{ secrets.KOOG_SPM_APP_KEY }} | |
| with: | |
| app-id: ${{ vars.KOOG_SPM_APP_ID }} | |
| private-key: ${{ env.PRIVATE_KEY }} | |
| repositories: koog-spm | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: false | |
| - name: Verify Xcode installation | |
| run: xcodebuild -version | |
| - name: Build XCFramework | |
| run: | | |
| echo "Assembling XCFramework binary..." | |
| ./gradlew :koog-agents:assembleKoogXCFramework -Pkoog.build.xcframework=true --no-daemon --stacktrace | |
| echo "XCFramework binary assembled" | |
| # Uploads XCF as a 30-day artifact for manual testing runs — does not pollute GitHub releases | |
| # We don't zip explicitly, because `upload-artifact` action does it for us | |
| - name: Upload XCFramework artifact for testing | |
| if: steps.resolve.outputs.target == 'artifact' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Koog-xcframework-${{ steps.resolve.outputs.version }} | |
| path: koog-agents/build/XCFrameworks/release/ | |
| retention-days: 30 | |
| - name: Create XCFramework zip for release | |
| if: steps.resolve.outputs.target == 'release' | |
| id: archive | |
| run: | | |
| ARCHIVE_NAME="Koog-${{ steps.resolve.outputs.version }}.xcframework.zip" | |
| cd koog-agents/build/XCFrameworks/release | |
| zip -r "$ARCHIVE_NAME" Koog.xcframework | |
| echo "archive_path=$(pwd)/$ARCHIVE_NAME" >> $GITHUB_OUTPUT | |
| echo "XCFramework zip created:" | |
| ls -lh "$ARCHIVE_NAME" | |
| # Calculate checksum for SPM | |
| CHECKSUM=$(shasum -a 256 "$ARCHIVE_NAME" | awk '{ print $1 }') | |
| echo "checksum=$CHECKSUM" >> $GITHUB_OUTPUT | |
| echo "url=https://github.com/JetBrains/koog/releases/download/${{ steps.resolve.outputs.version }}/$ARCHIVE_NAME" >> $GITHUB_OUTPUT | |
| echo "Checksum: $CHECKSUM" | |
| - name: Upload XCFramework zip to release | |
| if: steps.resolve.outputs.target == 'release' | |
| run: gh release upload "${{ steps.resolve.outputs.version }}" "${{ steps.archive.outputs.archive_path }}" --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Dispatch koog-spm release | |
| if: steps.resolve.outputs.target == 'release' | |
| run: | | |
| gh api repos/JetBrains/koog-spm/dispatches \ | |
| --method POST \ | |
| --input - << EOF | |
| { | |
| "event_type": "update-package", | |
| "client_payload": { | |
| "version": "${{ steps.resolve.outputs.version }}", | |
| "url": "${{ steps.archive.outputs.url }}", | |
| "checksum": "${{ steps.archive.outputs.checksum }}" | |
| } | |
| } | |
| EOF | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} |