Skip to content

Commit

Permalink
Publish SPM
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikvaa committed May 3, 2024
1 parent 736c8bd commit e059fd7
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 24 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
create:
tags:
- '^[0-9]+\.[0-9]+\.[0-9]+$'
push:
branches:
- publish-spm

jobs:
build:
runs-on: macos-latest
Expand All @@ -17,11 +21,16 @@ jobs:
java-version: 17
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Publish to GitHub Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_ACCESS_TOKEN_READ_PACKAGES: ${{ secrets.ACCESS_TOKEN_READ_PACKAGES }}
shell: sh
run: |
sh gradlew --no-daemon publishAllPublicationsToAirthingsGitHubPackagesRepository
publish:
needs: build
permissions:
contents: write
packages: write
uses: touchlab/KMMBridgeGithubWorkflow/.github/workflows/[email protected]
with:
runsOn: "macOS-14"
jvmVersion: 17
versionBaseProperty: LIBRARY_VERSION
publishTask: kmmBridgePublish publishKotlinMultiplatformPublicationToGitHubPackagesRepository publishAndroidReleasePublicationToGitHubPackagesRepository
secrets:
gradle_params: -PGITHUB_PUBLISH_USER=${{ secrets.GITHUB_ACTOR }} -PGITHUB_PUBLISH_TOKEN=${{ secrets.GITHUB_TOKEN }} -PGITHUB_REPO=https://github.com/Airthings/KmpLog.git
41 changes: 25 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

rootProject.group = "com.airthings.lib"
rootProject.version = "0.2.6"
val autoVersion = project.property(
if (project.hasProperty("AUTO_VERSION")) {
"AUTO_VERSION"
} else {
"LIBRARY_VERSION"
},
) as String

rootProject.group = "${properties["GROUP"]}"
rootProject.version = autoVersion

val iosFrameworkName = "${properties["IOS_FRAMEWORK_NAME"]}"

buildscript {
repositories {
Expand Down Expand Up @@ -52,6 +62,7 @@ plugins {
id("com.github.ben-manes.versions")
id("com.android.library")
id("maven-publish")
id("co.touchlab.kmmbridge")
}

dependencies {
Expand Down Expand Up @@ -105,7 +116,7 @@ kotlin {
linkerOpts += "-ld64"
}
it.binaries.framework {
baseName = rootProject.name
baseName = iosFrameworkName
}
}

Expand Down Expand Up @@ -170,18 +181,16 @@ android {
}
}

publishing {
repositories {
mavenLocal()
maven {
name = "AirthingsGitHubPackages"
url = uri("https://maven.pkg.github.com/airthings/kmplog")

credentials {
// The following are automatically generated by GitHub.
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
kmmbridge {
frameworkName.set(iosFrameworkName)
mavenPublishArtifacts()
spm(
spmDirectory = "./",
swiftToolVersion = "5.9",
targetPlatforms = {
iOS { v("15") }
}
}
)
}

addGithubPackagesRepository()
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

# Versioning:
GROUP=com.airthings.lib
LIBRARY_VERSION=0.2.7
IOS_FRAMEWORK_NAME=KmpLog

# Gradle/KMP options:
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
kotlin.code.style=official
Expand All @@ -42,6 +47,7 @@ version.plugin.androidGradle=8.1.2
version.plugin.ktlintGradle=11.6.1
version.plugin.detekt=1.23.3
version.plugin.outdated=0.49.0
version.plugin.kmmbridge=0.5.5

# Dependencies:
version.kotlin=1.9.22
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pluginManagement {
"org.jlleitschuh.gradle.ktlint" -> useVersion("${props["version.plugin.ktlintGradle"]}")
"com.github.ben-manes.versions" -> useVersion("${props["version.plugin.outdated"]}")
"com.android.library" -> useVersion("${props["version.plugin.androidGradle"]}")
"co.touchlab.kmmbridge" -> useVersion("${props["version.plugin.kmmbridge"]}")
}
}
}
Expand Down

0 comments on commit e059fd7

Please sign in to comment.