From 7199fc9d219ad77acd2495a4c0de9b78063e1c14 Mon Sep 17 00:00:00 2001 From: rhenwinch Date: Thu, 13 Jun 2024 18:20:19 +0800 Subject: [PATCH] ci(workflow): update GitHub workflow for prerelease handling and release logs - Removed configuration for prerelease APKs - Removed fatJar task - Added automatic generation of release logs - Fixed updating pre-release tag to bump the prerelease section to be the first one users see on the release page These changes streamline the release process and ensure that prerelease information is prominently displayed for users. --- .github/parse_version.sh | 10 +++ .github/workflows/Build.yml | 62 +++++++------------ app/build.gradle.kts | 10 --- .../kotlin/com/flixclusive/KotlinAndroid.kt | 7 --- build.gradle.kts | 20 +----- 5 files changed, 37 insertions(+), 72 deletions(-) create mode 100644 .github/parse_version.sh diff --git a/.github/parse_version.sh b/.github/parse_version.sh new file mode 100644 index 00000000..61c48bce --- /dev/null +++ b/.github/parse_version.sh @@ -0,0 +1,10 @@ +# Define the path to the file +FILE="./app/build.gradle.kts" + +# Extract the version numbers from the file +versionMajor=$(grep 'val versionMajor' "$FILE" | awk '{print $4}') +versionMinor=$(grep 'val versionMinor' "$FILE" | awk '{print $4}') +versionPatch=$(grep 'val versionPatch' "$FILE" | awk '{print $4}') + +# Output the version in the desired format +echo "$versionMajor.$versionMinor.$versionPatch" \ No newline at end of file diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 79af1890..a568c175 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -37,9 +37,9 @@ jobs: - name: Build release artifacts uses: gradle/gradle-command-action@v2 with: - arguments: :app:assembleRelease assemblePrerelease bundlePrereleaseClassesToCompileJar fatJar + arguments: assembleRelease bundleReleaseClassesToCompileJar - - name: Generate plugins stubs + - name: Generate class stubs uses: gradle/gradle-command-action@v2 with: arguments: generateStubsJar @@ -53,58 +53,44 @@ jobs: keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} keyPassword: ${{ secrets.KEY_PASSWORD }} - - name: Sign pre-release APK - uses: r0adkll/sign-android-release@v1 - with: - releaseDirectory: app/build/outputs/apk/prerelease - signingKeyBase64: ${{ secrets.SIGNING_KEY }} - alias: ${{ secrets.ALIAS }} - keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} - keyPassword: ${{ secrets.KEY_PASSWORD }} - - name: Clean up build artifacts run: | set -e mv app/build/outputs/apk/release/app-release-unsigned-signed.apk flixclusive-release.apk - sha=`sha256sum flixclusive-release.apk | awk '{ print $1 }'` - echo "RELEASE_SHA=$sha" >> $GITHUB_ENV - - mv app/build/outputs/apk/prerelease/app-prerelease-unsigned-signed.apk flixclusive-prerelease.apk - sha=`sha256sum flixclusive-prerelease.apk | awk '{ print $1 }'` - echo "PRERELEASE_SHA=$sha" >> $GITHUB_ENV - - - - name: Create Pre-release - uses: softprops/action-gh-release@v1 + + - name: Delete old pre-release + uses: cb80/delrel@latest with: - tag_name: "pre-release" - name: "Pre-release build" + tag: pre-release + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get soon-latest version + run: | + chmod +x .github/parse_version.sh + version=$(.github/parse_version.sh) + echo "Version: $version" + echo "VERSION=$version" >> $GITHUB_ENV + + - name: Upload pre-release + uses: softprops/action-gh-release@v2 + with: + tag_name: pre-release + name: Pre-release for v${{ env.VERSION }} body: | - --- - _NOTE: Android TV is incomplete, the providers on this port are not yet installable. Though, you could test it now._ + ##### _NOTE: Android TV is incomplete, the providers on this port are not yet installable. Though, you could test it now._ - ### Changes - - No official change logs yet. + --- - ### Known issues + ## Known issues - TV focus crashes. Compose TV is bugged af; we wait til the new update. --- - ##### The `prerelease` apk is similar to release but for _debugging_ purposes only. Use this if you want to test the latest features without messing up your authentic release data. - --- - - ### Checksums - | Variant | SHA-256 | - | ------- | ------- | - | release | ${{ env.RELEASE_SHA }} | - | pre-release | ${{ env.PRERELEASE_SHA }} | files: | flixclusive-release.apk - flixclusive-prerelease.apk - app/build/libs/fat-sources.jar app/build/classes.jar draft: false prerelease: true + generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d466f937..de1f3b24 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -47,16 +47,6 @@ android { } buildTypes { - getByName("prerelease") { - initWith(getByName("release")) - applicationIdSuffix = ".pre_release" - versionNameSuffix = "-[${getCommitVersion()}]" - - resValue("string", "app_name", "$applicationName Beta") - resValue("string", "application_id", _applicationId + applicationIdSuffix) - resValue("string", "version_name", _versionName + versionNameSuffix) - } - debug { applicationIdSuffix = ".debug" versionNameSuffix = "-DEBUG" diff --git a/build-logic/convention/src/main/kotlin/com/flixclusive/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/com/flixclusive/KotlinAndroid.kt index c9f9712f..a1af9771 100644 --- a/build-logic/convention/src/main/kotlin/com/flixclusive/KotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/com/flixclusive/KotlinAndroid.kt @@ -23,13 +23,6 @@ internal fun Project.configureKotlinAndroid( testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } - /* - * Create a pre-release build type to have a debuggable release. - * */ - buildTypes { - create("prerelease") - } - compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 diff --git a/build.gradle.kts b/build.gradle.kts index d32c5f36..adf7412c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,22 +19,8 @@ plugins { id("com.osacky.doctor") version "0.9.1" } -// Generate a mf FAT AHH JAR! -tasks.register("fatJar") { - archiveBaseName.set("fat") - archiveClassifier.set("sources") - destinationDirectory.set(File("app/build/libs")) - - subprojects.forEach { project -> - if (project.subprojects.size == 0) { - val projectPath = "." + project.path.replace(":", "/") - from("$projectPath/src/main/kotlin", "$projectPath/src/main/java") - } - } -} - // Generate the stubs jar for the providers-system. -// Must only be run after the task: bundlePrereleaseClassesToCompileJar or build. +// Must only be run after the task: bundleReleaseClassesToCompileJar or build. tasks.register("generateStubsJar") { archiveBaseName.set("classes") archiveClassifier.set("") @@ -43,7 +29,7 @@ tasks.register("generateStubsJar") { subprojects.forEach { project -> if (project.subprojects.size == 0) { val projectPath = "." + project.path.replace(":", "/") - val appJar = File("${projectPath}/build/intermediates/compile_app_classes_jar/prerelease/classes.jar") + val appJar = File("${projectPath}/build/intermediates/compile_app_classes_jar/release/classes.jar") if (appJar.exists()) { from(zipTree(appJar)) { @@ -54,7 +40,7 @@ tasks.register("generateStubsJar") { from({ project.configurations.getByName("archives") .allArtifacts.files - .filter { it.name.contains("prerelease") } + .filter { it.name.contains("release") } .map(::zipTree) .map { bundle -> zipTree(bundle.files.first { it.name.endsWith("jar") })