mirror of
https://github.com/ReVanced/revanced-patches-template.git
synced 2026-01-11 05:46: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
|
- name: Install dependencies
|
||||||
run: npm install
|
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
|
- name: Release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
{
|
{
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
"path": "build/libs/*.jar"
|
"path": "build/libs/revanced-patches*"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "patches.json"
|
"path": "patches.json"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ plugins {
|
|||||||
alias(libs.plugins.kotlin)
|
alias(libs.plugins.kotlin)
|
||||||
alias(libs.plugins.binary.compatibility.validator)
|
alias(libs.plugins.binary.compatibility.validator)
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
|
signing
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "your.org"
|
group = "your.org"
|
||||||
@@ -24,7 +25,8 @@ kotlin {
|
|||||||
jvmToolchain(11)
|
jvmToolchain(11)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(Jar::class) {
|
tasks {
|
||||||
|
withType(Jar::class) {
|
||||||
manifest {
|
manifest {
|
||||||
attributes["Name"] = "Your Patches"
|
attributes["Name"] = "Your Patches"
|
||||||
attributes["Description"] = "Patches for ReVanced."
|
attributes["Description"] = "Patches for ReVanced."
|
||||||
@@ -36,37 +38,36 @@ tasks.withType(Jar::class) {
|
|||||||
attributes["Origin"] = "https://your.homepage"
|
attributes["Origin"] = "https://your.homepage"
|
||||||
attributes["License"] = "GNU General Public License v3.0"
|
attributes["License"] = "GNU General Public License v3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
register("buildDexJar") {
|
||||||
register<DefaultTask>("generateBundle") {
|
description = "Build and add a DEX to the JAR file"
|
||||||
description = "Generate DEX files and add them in the JAR file"
|
group = "build"
|
||||||
|
|
||||||
dependsOn(build)
|
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
|
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
|
||||||
.listFilesOrdered().last().resolve("d8").absolutePath
|
.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
|
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
workingDir = workingDirectory
|
workingDir = workingDirectory
|
||||||
commandLine = listOf(d8, artifacts)
|
commandLine = listOf(d8, patchesJar)
|
||||||
}
|
}
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
workingDir = workingDirectory
|
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
|
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
||||||
named("publish") {
|
publish {
|
||||||
dependsOn("generateBundle")
|
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