-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
107 additions
and
5 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,35 @@ | ||
name: Publish Android Library | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Decode Signing Key | ||
env: | ||
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SECRING }} | ||
run: | | ||
echo $SIGNING_SECRET_KEY_RING_FILE | base64 -d > $HOME/secring.gpg | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build and publish | ||
env: | ||
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
SIGNING_SECRET_KEY_RING_FILE: $HOME/secring.gpg | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
run: ./gradlew publish |
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 |
---|---|---|
@@ -1,16 +1,26 @@ | ||
import groovy.json.JsonBuilder | ||
|
||
buildscript { | ||
extra["awsAccessKeyId"] = System.getenv("AWS_ACCESS_KEY_ID") ?: findProperty("aws_access_key_id") | ||
extra["awsSecretAccessKey"] = System.getenv("AWS_SECRET_ACCESS_KEY") ?: findProperty("aws_secret_access_key") | ||
extra["sonatypeUsername"] = System.getenv("SONATYPE_USERNAME") ?: findProperty("sonatype_username") | ||
extra["sonatypePassword"] = System.getenv("SONATYPE_PASSWORD") ?: findProperty("sonatype_password") | ||
} | ||
|
||
plugins { | ||
alias(libs.plugins.android.application) | ||
alias(libs.plugins.jetbrains.kotlin.android) | ||
id("maven-publish") | ||
id("signing") | ||
} | ||
|
||
version = "0.1.3" | ||
android { | ||
namespace = "com.superwall.supercel" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
minSdk = 26 | ||
targetSdk = 34 | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
|
||
|
@@ -47,21 +57,78 @@ android { | |
dependencies { | ||
implementation("net.java.dev.jna:jna:5.14.0@aar") | ||
implementation(libs.coroutines) | ||
testImplementation(libs.junit) | ||
androidTestImplementation(libs.androidx.junit) | ||
androidTestImplementation(libs.androidx.espresso.core) | ||
} | ||
|
||
afterEvaluate { | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("release") { | ||
from(components["release"]) | ||
groupId = "com.superwall.supercel" | ||
artifactId = "supercel" | ||
version = "0.1.3" // Set your library version | ||
|
||
pom { | ||
name.set("SuperCEL") | ||
description.set("Superwall CEL Evaluator") | ||
url.set("https://superwall.com") | ||
|
||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://github.com/superwall/Superwall-Android?tab=MIT-1-ov-file#") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("ianrumac") | ||
name.set("Ian Rumac") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:[email protected]:superwall/SuperCEL-Android.git") | ||
developerConnection.set("scm:git:ssh://github.com:superwall/SuperCEL-Android.git") | ||
url.set("scm:git:https://github.com/superwall/SuperCEL-Android.git") | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
|
||
val sonatypeUsername: String? by extra | ||
val sonatypePassword: String? by extra | ||
|
||
if (sonatypeUsername != null && sonatypePassword != null) { | ||
maven { | ||
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
credentials(PasswordCredentials::class.java) { | ||
username = sonatypeUsername | ||
password = sonatypePassword | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
signing { | ||
val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") | ||
val signingPassword: String? = System.getenv("SIGNING_PASSWORD") | ||
val signingSecretKeyRingFile: String? = System.getenv("SECRING") | ||
useInMemoryPgpKeys(signingKeyId, signingPassword, signingSecretKeyRingFile) | ||
sign(publishing.publications["release"]) | ||
} | ||
} | ||
|
||
tasks.register("generateBuildInfo") { | ||
doLast { | ||
var buildInfo = mapOf("version" to version) | ||
val jsonOutput = JsonBuilder(buildInfo).toPrettyString() | ||
val outputFile = File("${getLayout().buildDirectory}/version.json") | ||
outputFile.writeText(jsonOutput) | ||
} | ||
} | ||
|