diff --git a/build.gradle.kts b/build.gradle.kts index e9262eb31..ffec82f3c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ plugins { kotlin("jvm") version "1.6.10" + java `maven-publish` } @@ -8,10 +9,14 @@ group = "net.revanced" repositories { mavenCentral() maven { - url = uri("https://maven.pkg.github.com/ReVancedTeam/revanced-patcher") + url = uri("https://maven.pkg.github.com/ReVancedTeam/revanced-patcher") // note the "r"! credentials { - username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME") - password = project.findProperty("gpr.key") as String? ?: System.getenv("REVANCED_PATCHER_GITHUB_PACKAGE_TOKEN") + // DO NOT set these variables in the project's gradle.properties. + // Instead, you should set them in: + // Windows: %homepath%\.gradle\gradle.properties + // Linux: ~/.gradle/gradle.properties + username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") // DO NOT CHANGE! + password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") // DO NOT CHANGE! } } } @@ -24,5 +29,28 @@ dependencies { implementation("org.ow2.asm:asm-tree:9.2") implementation("org.ow2.asm:asm-commons:9.2") - implementation("net.revanced:revanced-patcher:1.0.0-dev.7") + implementation("net.revanced:revanced-patcher:1.+") // use latest version. +} + +java { + withSourcesJar() + withJavadocJar() +} + +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/ReVancedTeam/revanced-patches") // note the "s"! + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } + publications { + register("gpr") { + from(components["java"]) + } + } } \ No newline at end of file