feat: prereleases

This commit is contained in:
Benjamin Halko 2024-01-23 11:15:38 -08:00
parent 607d8b67c9
commit 9e344a990b
No known key found for this signature in database
GPG key ID: 790C70040EB331A0
7 changed files with 7065 additions and 27 deletions

View file

@ -1,9 +1,11 @@
name: Release Build
on:
workflow_dispatch:
push:
tags:
- "v*"
branches:
- main
- dev
jobs:
build:
@ -11,8 +13,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v4
@ -20,6 +20,16 @@ jobs:
java-version: '17'
distribution: 'temurin'
- name: Cache Node modules
uses: actions/cache@v3
with:
path: |
node_modules
key: npm-${{ hashFiles('package-lock.json') }}
- name: Setup semantic-release
run: npm install
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
@ -28,24 +38,10 @@ jobs:
- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew assembleRelease --no-daemon
- name: Sign APK
id: sign_apk
uses: ilharp/sign-android-release@v1
with:
releaseDir: ./app/build/outputs/apk/release/
signingKey: ${{ secrets.SIGNING_KEYSTORE }}
signingKey: "keystore.jks"
keyStorePassword: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
keyAlias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Add version to APK
run: mv ${{ steps.sign_apk.outputs.signedFile }} revanced-manager-${{ env.RELEASE_VERSION }}.apk
- name: Publish release APK
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: revanced-manager-${{ env.RELEASE_VERSION }}.apk
run: |
echo ${{ secrets.SIGNING_KEYSTORE }} | base64 --decode > keystore.jks
npx semantic-release

2
.gitignore vendored
View file

@ -8,4 +8,4 @@
.externalNativeBuild
.cxx
local.properties
/node_modules

47
.releaserc Normal file
View file

@ -0,0 +1,47 @@
{
"branches": [
"main",
{
"name": "dev",
"prerelease": true
}
],
"plugins": [
[
"@semantic-release/commit-analyzer", {
"releaseRules": [
{ "type": "build", "scope": "Needs bump", "release": "patch" }
]
}
],
"@semantic-release/changelog",
"@semantic-release/release-notes-generator",
"gradle-semantic-release-plugin",
[
"@semantic-release/git",
{
"assets": [
"gradle.properties"
]
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "app/build/outputs/apk/release/*.apk"
}
],
"successComment": false
}
],
[
"@saithodev/semantic-release-backmerge",
{
"backmergeBranches": [{"from": "main", "to": "dev"}],
"clearWorkspace": true
}
]
]
}

View file

@ -7,6 +7,7 @@ plugins {
kotlin("plugin.serialization") version "1.9.10"
}
val (majorVersion, minorVersion, patchVersion, devVersion) = "${project.version}.0".replace("-dev","").split(".")
android {
namespace = "app.revanced.manager"
compileSdk = 34
@ -16,14 +17,26 @@ android {
applicationId = "app.revanced.manager"
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "0.0.1"
versionName = project.version.toString()
versionCode = (majorVersion.toInt() * 100000000) + (minorVersion.toInt() * 100000) + (patchVersion.toInt() * 100) + devVersion.toInt()
resourceConfigurations.addAll(listOf(
"en",
))
vectorDrawables.useSupportLibrary = true
}
val hasReleaseConfig = (System.getenv("KEYSTORE_FILE") != null)
signingConfigs {
if (hasReleaseConfig) {
create("release") {
storeFile = file(System.getenv("KEYSTORE_FILE"))
storePassword = System.getenv("KEYSTORE_PASSWORD")
keyAlias = System.getenv("KEY_ALIAS")
keyPassword = System.getenv("KEY_PASSWORD")
}
}
}
buildTypes {
debug {
applicationIdSuffix = ".debug"
@ -36,11 +49,19 @@ android {
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
if (project.hasProperty("signAsDebug")) {
applicationIdSuffix = ".debug"
resValue("string", "app_name", "ReVanced Manager Debug")
signingConfig = signingConfigs.getByName("debug")
} else if (hasReleaseConfig) {
signingConfig = signingConfigs.getByName("release")
}
applicationVariants.all {
this.outputs
.map { it as com.android.build.gradle.internal.api.BaseVariantOutputImpl }
.forEach { output ->
output.outputFileName = "revanced-manager-v${project.version}.apk"
}
}
}
}
@ -89,6 +110,12 @@ kotlin {
jvmToolchain(17)
}
tasks.register("publish") {
group = "Build"
description = "Assemble main outputs for all the variants."
dependsOn("assembleRelease")
}
dependencies {
// AndroidX Core

View file

@ -21,4 +21,5 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonFinalResIds=false
android.nonFinalResIds=false
version=0.0.1

6958
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

9
package.json Normal file
View file

@ -0,0 +1,9 @@
{
"devDependencies": {
"@saithodev/semantic-release-backmerge": "^4.0.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"gradle-semantic-release-plugin": "^1.9.1",
"semantic-release": "^23.0.0"
}
}