-
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.
Add github action for publishing (#3)
Also fix gradle wrapper
- Loading branch information
Showing
9 changed files
with
319 additions
and
150 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,48 @@ | ||
name: cd | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
|
||
jobs: | ||
validation: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Validate tag is valid | ||
run: | | ||
echo "${{ github.ref_name }}" | grep -P '^[0-9]+\.[0-9]+\.[0-9]+' | ||
main: | ||
runs-on: ubuntu-latest | ||
needs: validation | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
gpg_private_key: ${{ secrets.MAVEN_GPG_KEY }} | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- name: Publish package to GHCR | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: publish | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VERSION: ${{ github.event.inputs.version }} | ||
- name: Publish package to Central | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: publishReleasePublicationToCentralPortal | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | ||
VERSION: ${{ github.event.inputs.version }} |
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
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 |
---|---|---|
|
@@ -2,35 +2,78 @@ plugins { | |
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
`maven-publish` | ||
} | ||
|
||
tasks { | ||
val sourcesJar by creating(Jar::class) { | ||
archiveClassifier.set("sources") | ||
from(android.sourceSets.getByName("main").java.srcDirs) | ||
} | ||
id("signing") | ||
id("com.gradleup.nmcp") | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
url = uri("") | ||
name = "GitHubPackages" | ||
url = uri("https://maven.pkg.github.com/spruceid/wallet-sdk-rs") | ||
credentials { | ||
username = System.getenv("GITHUB_ACTOR") | ||
password = System.getenv("GITHUB_TOKEN") | ||
} | ||
} | ||
} | ||
|
||
publications { | ||
// Creates a Maven publication called "release". | ||
create<MavenPublication>("release") { | ||
groupId = "com.spruceid.wallet.sdk" | ||
artifactId = "walletsdk" | ||
version = System.getenv("VERSION") | ||
|
||
afterEvaluate { | ||
groupId = "com.spruceid.wallet.sdk" | ||
artifactId = "walletsdk" | ||
version = "0.0.1" | ||
artifact(tasks.getByName<Jar>("sourcesJar")) | ||
from(components["release"]) | ||
} | ||
|
||
pom { | ||
packaging = "aar" | ||
name.set("walletsdk") | ||
description.set("Android SpruceID Wallet SDK") | ||
url.set("https://github.com/spruceid/wallet-sdk-kt") | ||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://opensource.org/license/mit/") | ||
} | ||
license { | ||
name.set("Apache License, Version 2.0") | ||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
developers { | ||
developer { | ||
name.set("Spruce Systems, Inc.") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
url.set(pom.url.get()) | ||
connection.set("scm:git:${url.get()}.git") | ||
developerConnection.set("scm:git:${url.get()}.git") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
useGpgCmd() | ||
sign(publishing.publications["release"]) | ||
} | ||
|
||
nmcp { | ||
afterEvaluate { | ||
publish("release") { | ||
username = System.getenv("MAVEN_USERNAME") | ||
password = System.getenv("MAVEN_PASSWORD") | ||
publicationType = "AUTOMATIC" | ||
} | ||
} | ||
} | ||
|
||
|
||
android { | ||
namespace = "com.spruceid.walletsdk" | ||
|
@@ -58,6 +101,13 @@ android { | |
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
|
||
publishing { | ||
singleVariant("release") { | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
@@ -66,4 +116,4 @@ dependencies { | |
testImplementation("junit:junit:4.13.2") | ||
androidTestImplementation("com.android.support.test:runner:1.0.2") | ||
androidTestImplementation("com.android.support.test.espresso:espresso-core:3.0.2") | ||
} | ||
} |
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,6 +1,7 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
plugins { | ||
id("com.android.application") version "8.1.2" apply false | ||
id("com.android.application") version "8.3.0" apply false | ||
id("org.jetbrains.kotlin.android") version "1.8.10" apply false | ||
id("com.android.library") version "8.1.2" apply false | ||
} | ||
id("com.android.library") version "8.3.0" apply false | ||
id("com.gradleup.nmcp") version "0.0.4" apply true | ||
} |
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
Binary file not shown.
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,6 +1,7 @@ | ||
#Thu Jan 25 11:00:12 BRT 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.