Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare to publish to OSSRH #49

Merged
merged 3 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
java-version: "17"
check-latest: false
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.4.2
with:
dependency-graph: generate-and-submit
- name: Setup Rust
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: publish

on:
# For convenience, run upon tagging a release.
release:
types:
- published
# This is mainly intended for snapshots.
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: "17"
check-latest: false
- name: Setup Gradle
uses: gradle/[email protected]
- name: Setup Rust
id: rust-toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
- name: Rust caching
uses: Swatinem/rust-cache@v2
with:
key: ${{ steps.rust-toolchain.outputs.cachekey }}
workspaces: divviup/rust
- name: Upload artifacts
env:
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_SIGNING_PASSPHRASE }}
run: ./gradlew :divviup:publishReleasePublicationToOSSRHRepository
34 changes: 34 additions & 0 deletions divviup/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id("com.android.library")
id("org.mozilla.rust-android-gradle.rust-android")
id("maven-publish")
signing
}

android {
Expand Down Expand Up @@ -127,4 +128,37 @@ publishing {
}
}
}

repositories {
maven {
name = "OSSRH"

val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl

authentication {
register<BasicAuthentication>("basic")
}

credentials {
val ossrhUsername: String? by project
val ossrhPassword: String? by project
username = ossrhUsername
password = ossrhPassword
}
}
}
}

signing {
sign(publishing.publications["release"])

val signingKey: String? by project
val signingPassword: String? by project
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
} else {
useGpgCmd()
}
}
Loading