Abhishek Agarwal
02/05/2025, 7:23 PMAbhishek Agarwal
02/05/2025, 7:26 PMname: Base-Publish
on:
workflow_call:
inputs:
build-debug:
description: If set to true, the Xcode framework is debuggable. For release builds, setting to false produces more optimized binaries.
required: true
type: boolean
publish-tasks:
description: By default, the tasks will publish Android AARs and Xcode frameworks. For iOS-only builds, pass in 'kmmBridgePublish'.
required: false
default: " kmmBridgePublish"
type: string
permissions:
contents: write
packages: write
jobs:
kmmbridgepublish:
concurrency: "kmmbridgepublish-${{ github.repository }}" # Potentially not necessary, but helps ensure sequential releases
runs-on: macos-latest
steps:
- name: Checkout the repo with tags
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: touchlab/read-property@0.1
id: versionPropertyValue
with:
file: ./gradle.properties
property: LIBRARY_VERSION # The release version. Defined in gradle.properties.
- name: Print versionPropertyValue
id: output
run: echo "${{ steps.versionPropertyValue.outputs.propVal }}"
- name: Touchlab Sample Sanity Check (Ignore this for your CI) # GitHub Packages can have issues with conflicting maven coordinates.
uses: touchlab/sample-group-sanity-check@main
- uses: actions/setup-java@v4
with:
distribution: "adopt"
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Create or Find Artifact Release
id: devrelease
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: "${{ steps.versionPropertyValue.outputs.propVal }}"
- name: Build Main
run: |
./gradlew ${{ inputs.publish-tasks }} \
-PNATIVE_BUILD_TYPE=${{ inputs.build-debug && 'DEBUG' || 'RELEASE' }} \
-PGITHUB_ARTIFACT_RELEASE_ID=${{ steps.devrelease.outputs.id }} \
-PGITHUB_PUBLISH_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-PGITHUB_REPO=${{ github.repository }} \
-PENABLE_PUBLISHING=true \
--no-daemon --info --stacktrace
env:
GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m"
# The GitHub Release hosts the Xcode binary, but we need to query GitHub for the URL after the binary is uploaded,
# then generate the Package.swift file. Once that is committed, we need to point the release tag at the final commit.
- uses: touchlab/ga-update-release-tag@v1
id: update-release-tag
with:
commitMessage: "KMP SPM package release for ${{ steps.versionPropertyValue.outputs.propVal }}"
tagMessage: "KMP release version ${{ steps.versionPropertyValue.outputs.propVal }}"
tagVersion: ${{ steps.versionPropertyValue.outputs.propVal }}
Abhishek Agarwal
02/06/2025, 3:36 AMkpgalligan
02/06/2025, 4:09 AM-PGITHUB_ARTIFACT_RELEASE_ID=${{ steps.devrelease.outputs.id }}
is provided.
So, the question is if this is a build that was generated from the template entirely, or if the workflow you're using was pulled from the template and applied to an existing project. If the KMMBridge version in the existing project is older, it wouldn't know about that flag, and then attempt to create an existing release (and fail).
If this is a fresh project created directly from the template, that's a different story, and we'll need to see if we can repro.
If it is an older project with a newer workflow copied in, you can either update KMMBridge, or remove the lines creating the release:
- name: Create or Find Artifact Release
id: devrelease
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: "${{ steps.versionPropertyValue.outputs.propVal }}"
In either case, the general "why" is because KMMBridge came out of a much more complex tool that was doing too much, and the following releases have tried to isolate KMMBridge itself to a clear purpose and role. Having KMMBridge create the release, but the workflow then assume it in following steps, wasn't a great design. However, upgrading KMMBridge can be a delicate situation.
If this is a fresh template pull, though, let me know. It should certainly not be throwing that error.