Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
build: Sign release artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Feb 22, 2024
1 parent 4d0db8c commit 0dc61d9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,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 }}
Expand Down
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{
"assets": [
{
"path": "app/build/outputs/apk/release/*.apk"
"path": "app/build/outputs/apk/release/revanced-integrations*"
}
],
successComment: false
Expand Down
26 changes: 21 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin)
publishing
}

android {
Expand All @@ -20,7 +21,7 @@ android {
minSdk = 23
targetSdk = 33
multiDexEnabled = false
versionName = project.version as String
versionName = version as String
}

buildTypes {
Expand Down Expand Up @@ -53,12 +54,27 @@ dependencies {
}

tasks {
// Because the signing plugin doesn't support signing APKs, do it manually.
register("sign") {
group = "signing"

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
register("publish") {
group = "publishing"
description = "Publishes all publications produced by this project."

publish {
dependsOn(build)
dependsOn("sign")
}
}

0 comments on commit 0dc61d9

Please sign in to comment.