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

build: Publish artifacts to Maven Central #251

Merged
merged 1 commit into from
Oct 7, 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
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build clean --no-daemon
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Setup semantic-release
run: npm install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
run: npm exec semantic-release
Empty file added api/revanced-patcher.api
Empty file.
79 changes: 76 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,83 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension

plugins {
kotlin("jvm") version "1.9.0" apply false
kotlin("jvm") version "1.9.0"
alias(libs.plugins.binary.compatibility.validator)
`maven-publish`
signing
java
}

allprojects {
val githubUsername: String = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
val githubPassword: String = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")

val isDev = project.version.toString().contains("-dev")

var publicationVersion = project.version.toString()
if (isDev) publicationVersion += "-SNAPSHOT"

subprojects {
apply(plugin = "maven-publish")
apply(plugin = "signing")
apply(plugin = "java")
apply(plugin ="kotlin")

group = "app.revanced"
}

extra["version"] = version

repositories {
mavenCentral()
mavenLocal()
google()
listOf("multidexlib2", "apktool").forEach { repo ->
maven {
url = uri("https://maven.pkg.github.com/revanced/$repo")
credentials {
username = githubUsername
password = githubPassword
}
}
}
}

java {
withJavadocJar()
withSourcesJar()
}

configure<KotlinJvmProjectExtension> {
kotlin { jvmToolchain(11) }
}

signing {
useGpgCmd()
sign(publishing.publications)
}

publishing {
repositories {
mavenLocal()
maven {
url = if (isDev)
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
else
uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")

credentials {
username = (System.getenv("OSSRH_USERNAME") ?: "").toString()
password = (System.getenv("OSSRH_PASSWORD") ?: "").toString()
}
}
}
}

tasks {
test {
useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
}
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 16.0.2
version = 16.0.2
31 changes: 2 additions & 29 deletions revanced-patch-annotation-processor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
kotlin("jvm") version "1.9.0"
alias(libs.plugins.ksp)
}

Expand All @@ -12,38 +11,12 @@ dependencies {
testImplementation(libs.kotlin.compile.testing)
}

tasks {
test {
useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
}
}
}

kotlin { jvmToolchain(11) }

java {
withSourcesJar()
}

publishing {
repositories {
mavenLocal()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("gpr") {
create<MavenPublication>("revanced-patch-annotation-processor-publication") {
from(components["java"])

version = project.version.toString()
version = extra["version"].toString()

pom {
name = "ReVanced patch annotation processor"
Expand Down
32 changes: 2 additions & 30 deletions revanced-patcher/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
plugins {
kotlin("jvm") version "1.9.0"
}

dependencies {
implementation(libs.kotlinx.coroutines.core)
implementation(libs.xpp3)
Expand All @@ -17,41 +13,17 @@ dependencies {
}

tasks {
test {
useJUnitPlatform()
testLogging {
events("PASSED", "SKIPPED", "FAILED")
}
}

processResources {
expand("projectVersion" to project.version)
}
}

kotlin { jvmToolchain(11) }

java {
withSourcesJar()
}

publishing {
repositories {
mavenLocal()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("gpr") {
create<MavenPublication>("revanced-patcher-publication") {
from(components["java"])

version = project.version.toString()
version = extra["version"].toString()

pom {
name = "ReVanced Patcher"
Expand Down
21 changes: 0 additions & 21 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1 @@
val githubUsername: String = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
val githubPassword: String = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
google()
mavenLocal()
listOf("multidexlib2", "apktool").forEach { repo ->
maven {
url = uri("https://maven.pkg.github.com/revanced/$repo")
credentials {
username = githubUsername
password = githubPassword
}
}
}
}
}

include("revanced-patch-annotation-processor", "revanced-patcher")