Skip to content

Commit

Permalink
ci(workflow): update GitHub workflow for prerelease handling and rele…
Browse files Browse the repository at this point in the history
…ase 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.
  • Loading branch information
rhenwinch committed Jun 13, 2024
1 parent ef319a0 commit 7199fc9
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 72 deletions.
10 changes: 10 additions & 0 deletions .github/parse_version.sh
Original file line number Diff line number Diff line change
@@ -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"
62 changes: 24 additions & 38 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
10 changes: 0 additions & 10 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 3 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,8 @@ plugins {
id("com.osacky.doctor") version "0.9.1"
}

// Generate a mf FAT AHH JAR!
tasks.register<Jar>("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<Jar>("generateStubsJar") {
archiveBaseName.set("classes")
archiveClassifier.set("")
Expand All @@ -43,7 +29,7 @@ tasks.register<Jar>("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)) {
Expand All @@ -54,7 +40,7 @@ tasks.register<Jar>("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") })
Expand Down

0 comments on commit 7199fc9

Please sign in to comment.