build: Sign release artifacts

This commit is contained in:
oSumAtrIX 2024-02-22 06:13:17 +01:00
parent 4d0db8c4fb
commit 0dc61d9da4
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
3 changed files with 30 additions and 7 deletions

View File

@ -40,6 +40,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 }}

View File

@ -25,7 +25,7 @@
{ {
"assets": [ "assets": [
{ {
"path": "app/build/outputs/apk/release/*.apk" "path": "app/build/outputs/apk/release/revanced-integrations*"
} }
], ],
successComment: false successComment: false

View File

@ -1,6 +1,7 @@
plugins { plugins {
alias(libs.plugins.android.application) alias(libs.plugins.android.application)
alias(libs.plugins.kotlin) alias(libs.plugins.kotlin)
publishing
} }
android { android {
@ -20,7 +21,7 @@ android {
minSdk = 23 minSdk = 23
targetSdk = 33 targetSdk = 33
multiDexEnabled = false multiDexEnabled = false
versionName = project.version as String versionName = version as String
} }
buildTypes { buildTypes {
@ -53,12 +54,27 @@ dependencies {
} }
tasks { tasks {
// Needed by gradle-semantic-release-plugin. // Because the signing plugin doesn't support signing APKs, do it manually.
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435 register("sign") {
register("publish") { group = "signing"
group = "publishing"
description = "Publishes all publications produced by this project."
dependsOn(build) dependsOn(build)
doLast {
val outputDirectory = layout.buildDirectory.dir("outputs/apk/release").get().asFile
val integrationsApk = outputDirectory.resolve("${rootProject.name}-$version.apk")
org.gradle.security.internal.gnupg.GnupgSignatoryFactory().createSignatory(project).sign(
integrationsApk.inputStream(),
outputDirectory.resolve("${integrationsApk.name}.asc").outputStream(),
)
}
}
// Needed by gradle-semantic-release-plugin.
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
publish {
dependsOn(build)
dependsOn("sign")
} }
} }