Skip to content

Commit

Permalink
Add publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-ramotar committed Jan 12, 2024
1 parent 6abec9b commit f8127c9
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 2 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish

on:
push:
branches: [ main ]

jobs:
publish:
runs-on: macos-latest
if: github.repository == 'wandering-inc/scoop-sdk-kotlin' && github.ref == 'refs/heads/main'

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up our JDK environment
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 17

- name: Upload Artifacts
run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}

- name: Retrieve version
run: |
echo "VERSION_NAME=$(cat gradle.properties | grep -w "VERSION_NAME" | cut -d'=' -f2)" >> $GITHUB_ENV
- name: Publish release
run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel
if: "!endsWith(env.VERSION_NAME, '-SNAPSHOT')"
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ buildscript {
google()
mavenCentral()
}

dependencies {
classpath(libs.maven.publish.plugin)
}
}

plugins {
Expand Down
16 changes: 16 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,19 @@ android.defaults.buildfeatures.resvalues=false
android.defaults.buildfeatures.shaders=false
android.defaults.buildFeatures.buildConfig=false
xcodeproj=./ios

# POM file
GROUP=ai.wandering.scoop
VERSION_NAME=1.0.0-SNAPSHOT
POM_PACKAGING=pom
POM_DESCRIPTION=Scoop's Kotlin SDK

POM_URL = https://github.com/wandering-inc/scoop-sdk-kotlin
POM_SCM_URL=https://github.com/wandering-inc/scoop-sdk-kotlin
POM_SCM_CONNECTION=scm:git:https://github.com/wandering-inc/scoop-sdk-kotlin.git
POM_SCM_DEV_CONNECTION=scm:git:[email protected]:wandering-inc/scoop-sdk-kotlin.git
POM_LICENCE_NAME=Apache License
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=wandering-inc
POM_DEVELOPER_NAME=wandering-inc
5 changes: 4 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ ksp = "1.9.21-1.0.15"
pbandk-runtime = "0.14.2"
scoop = "1.0.0"
serialization = "1.5.1"
maven-publish-plugin = "0.23.2"


[libraries]

coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }

ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-negotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
ktor-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" }
ktor-serialization-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }

maven-publish-plugin = { group = "com.vanniktech", name = "gradle-maven-publish-plugin", version.ref = "maven-publish-plugin" }

pbandk-runtime = { module = "pro.streem.pbandk:pbandk-runtime", version.ref = "pbandk-runtime" }

serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" }
serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }

Expand Down
4 changes: 4 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ pluginManagement {
google()
mavenCentral()
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version("0.5.0")
}
}

dependencyResolutionManagement {
Expand Down
14 changes: 13 additions & 1 deletion v1/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import com.vanniktech.maven.publish.SonatypeHost

plugins {
kotlin("multiplatform")
alias(libs.plugins.serialization)
id("com.android.library")
id("com.vanniktech.maven.publish")
}

kotlin {
Expand All @@ -28,4 +31,13 @@ kotlin {

android {
namespace = "ai.wandering.scoop.v1"
}

kotlin {
jvmToolchain(17)
}
}

mavenPublishing {
publishToMavenCentral(SonatypeHost.S01)
signAllPublications()
}
3 changes: 3 additions & 0 deletions v1/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POM_NAME=ai.wandering.scoop
POM_ARTIFACT_ID=v1
POM_PACKAGING=jar

0 comments on commit f8127c9

Please sign in to comment.