Skip to content
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
35 changes: 11 additions & 24 deletions .buildscript/configure-signing.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
apply plugin: "signing"
apply plugin: "com.vanniktech.maven.publish"

if (project.hasProperty('releaseBuild')) {
println "configuring signing key"

Properties properties = new Properties()
if (project.rootProject.file('local.properties').exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
}

signing {
def signingKeyFilename = properties.signingKey

def signingKey = "${project.rootProject.file(signingKeyFilename).newDataInputStream()}"
def signingPassword = properties.signingPassword

useInMemoryPgpKeys(signingKey, signingPassword)
}
// Environment variables are expected to be set via export_signing.sh:
// - ORG_GRADLE_PROJECT_mavenCentralUsername
// - ORG_GRADLE_PROJECT_mavenCentralPassword
// - ORG_GRADLE_PROJECT_signingInMemoryKey
// - ORG_GRADLE_PROJECT_signingInMemoryKeyId
// - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword

mavenPublish {
targets {
// Modify the existing uploadArchives task
uploadArchives {
repositoryUsername = properties.SONATYPE_NEXUS_USERNAME
repositoryPassword = properties.SONATYPE_NEXUS_PASSWORD
}
}
mavenPublishing {
publishToMavenCentral("CENTRAL_PORTAL")
signAllPublications()
}
} else {
mavenPublish {
releaseSigningEnabled = false
mavenPublishing {
publishToMavenCentral("CENTRAL_PORTAL")
}
}
4 changes: 3 additions & 1 deletion .buildscript/upload_archives.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
source export_signing.sh

./gradlew clean
./gradlew :lce:build -PreleaseBuild
./gradlew :lce-rxjava3:build -PreleaseBuild
Expand All @@ -6,4 +8,4 @@

# Disabling parallelism and daemon sharing is required by the vanniktech maven publish plugin.
# Without those, the artifacts will be split across multiple (invalid) staging repositories.
./gradlew uploadArchives -PreleaseBuild --no-parallel --no-daemon
./gradlew publishToMavenCentral -PreleaseBuild --no-parallel --no-daemon
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
.java-version

# Claude
.claude/settings.local.json
.claude/settings.local.json

# Signing
export_signing.sh
48 changes: 48 additions & 0 deletions SIGNING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Signing Configuration

## Setup

1. **Export your GPG secret key:**
```bash
gpg --export-secret-keys --armor YOUR_KEY_ID > /path/to/secring.gpg
```

2. **Get your Sonatype user tokens:**
- Go to https://central.sonatype.com/usertoken
- Click "Generate User Token"
- Save the username and password

3. **Create `export_signing.sh`:**
```bash
#!/bin/bash

# Configuration
SIGNING_KEY_FILE="/path/to/secring.gpg"
SIGNING_KEY_ID="8E72E6C6" # Last 8 chars of your GPG key ID
SIGNING_KEY_PASSWORD="your_gpg_passphrase"

# Maven Central credentials (Sonatype user tokens)
export ORG_GRADLE_PROJECT_mavenCentralUsername="your_token_username"
export ORG_GRADLE_PROJECT_mavenCentralPassword="your_token_password"

# GPG signing configuration
export ORG_GRADLE_PROJECT_signingInMemoryKey=$(cat "$SIGNING_KEY_FILE")
export ORG_GRADLE_PROJECT_signingInMemoryKeyId="$SIGNING_KEY_ID"
export ORG_GRADLE_PROJECT_signingInMemoryKeyPassword="$SIGNING_KEY_PASSWORD"

echo "Signing environment variables exported successfully"
```

4. **Make it executable:**
```bash
chmod +x export_signing.sh
```

## Usage

Run the upload script:
```bash
./.buildscript/upload_archives.sh
```

The script automatically sources `export_signing.sh` to set up signing.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=com.laimiux.lce
VERSION_NAME=0.4.0
VERSION_NAME=0.4.1

POM_DESCRIPTION=LCE

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ coroutines = "1.8.1"
[libraries]
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka-gradle" }
maven-publish-gradle = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.14.2" }
maven-publish-gradle = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.28.0" }
junit = { module = "junit:junit", version = "4.12" }
truth = { module = "com.google.truth:truth", version = "1.0.1" }
rxjava = { module = "io.reactivex.rxjava3:rxjava", version = "3.0.4" }
Expand Down