mirror of
https://github.com/ReVanced/revanced-patches-template.git
synced 2026-01-10 21:36:18 +00:00
build: Sign release artifacts
This commit is contained in:
7
.github/workflows/release.yml
vendored
7
.github/workflows/release.yml
vendored
@@ -41,6 +41,13 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Import GPG key
|
||||
uses: crazy-max/ghaction-import-gpg@v6
|
||||
with:
|
||||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||
fingerprint: ${{ env.GPG_FINGERPRINT }}
|
||||
|
||||
- name: Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
{
|
||||
"assets": [
|
||||
{
|
||||
"path": "build/libs/*.jar"
|
||||
"path": "build/libs/revanced-patches*"
|
||||
},
|
||||
{
|
||||
"path": "patches.json"
|
||||
|
||||
@@ -4,6 +4,7 @@ plugins {
|
||||
alias(libs.plugins.kotlin)
|
||||
alias(libs.plugins.binary.compatibility.validator)
|
||||
`maven-publish`
|
||||
signing
|
||||
}
|
||||
|
||||
group = "your.org"
|
||||
@@ -24,7 +25,8 @@ kotlin {
|
||||
jvmToolchain(11)
|
||||
}
|
||||
|
||||
tasks.withType(Jar::class) {
|
||||
tasks {
|
||||
withType(Jar::class) {
|
||||
manifest {
|
||||
attributes["Name"] = "Your Patches"
|
||||
attributes["Description"] = "Patches for ReVanced."
|
||||
@@ -36,37 +38,36 @@ tasks.withType(Jar::class) {
|
||||
attributes["Origin"] = "https://your.homepage"
|
||||
attributes["License"] = "GNU General Public License v3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
register<DefaultTask>("generateBundle") {
|
||||
description = "Generate DEX files and add them in the JAR file"
|
||||
|
||||
dependsOn(build)
|
||||
register("buildDexJar") {
|
||||
description = "Build and add a DEX to the JAR file"
|
||||
group = "build"
|
||||
|
||||
doLast {
|
||||
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
|
||||
.listFilesOrdered().last().resolve("d8").absolutePath
|
||||
|
||||
val artifacts = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
||||
val patchesJar = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
||||
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile
|
||||
|
||||
exec {
|
||||
workingDir = workingDirectory
|
||||
commandLine = listOf(d8, artifacts)
|
||||
commandLine = listOf(d8, patchesJar)
|
||||
}
|
||||
|
||||
exec {
|
||||
workingDir = workingDirectory
|
||||
commandLine = listOf("zip", "-u", artifacts, "classes.dex")
|
||||
commandLine = listOf("zip", "-u", patchesJar, "classes.dex")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Required to run tasks because Gradle semantic-release plugin runs the publish task.
|
||||
// Needed by gradle-semantic-release-plugin.
|
||||
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
||||
named("publish") {
|
||||
dependsOn("generateBundle")
|
||||
publish {
|
||||
dependsOn(build)
|
||||
dependsOn("buildDexJar")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,3 +103,9 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
sign(publishing.publications["revanced-patches-publication"])
|
||||
sign(configurations.archives.get()).first().dependsOn("buildDexJar")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user