From 0e0537292c67159200ebbfbc60ae65bd894e4c19 Mon Sep 17 00:00:00 2001 From: ExpanseCodes <126707260+ExpanseCodes@users.noreply.github.com> Date: Sat, 23 Sep 2023 12:54:37 +0530 Subject: [PATCH] feat: publish patches to maven central --- .github/workflows/release.yml | 11 ++++++- build.gradle.kts | 60 +++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b122f6350..570744050a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,9 +36,18 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: ./gradlew generateMeta clean + + - 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 }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} run: npm exec semantic-release diff --git a/build.gradle.kts b/build.gradle.kts index ef4cbf5664..1bcc4dab89 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,8 @@ plugins { kotlin("jvm") version "1.8.20" alias(libs.plugins.ksp) + `maven-publish` + signing } group = "app.revanced" @@ -25,6 +27,64 @@ repositories { } } + +signing { + useGpgCmd() + sign(publishing.publications) +} + +val isDev = project.version.toString().contains("-dev") + +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() + } + } + } + publications { + create("gpr") { + from(components["java"]) + + version = project.version.toString() + if (isDev) version += "-SNAPSHOT" + + pom { + name = "ReVanced Patches" + description = "Patches used by ReVanced." + url = "https://revanced.app" + + licenses { + license { + name = "GNU General Public License v3.0" + url = "https://www.gnu.org/licenses/gpl-3.0.en.html" + } + } + developers { + developer { + id = "ExpanseCodes" + name = "ExpanseCodes" + email = "contact@revanced.app" + } + } + scm { + connection = "scm:git:git://github.com/ExpanseCodes/revanced-patches.git" + developerConnection = "scm:git:git@github.com:ExpanseCodes/revanced-patches.git" + url = "https://github.com/ExpanseCodes/revanced-patches" + } + } + } + } +} + dependencies { implementation(libs.revanced.patcher) implementation(libs.smali)