mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 22:17:03 +05:30
feat(build): add support for Tramline builds
This commit is contained in:
parent
0e5caf591a
commit
1ab1520c60
2 changed files with 65 additions and 12 deletions
43
.github/workflows/tramline-release.yml
vendored
Normal file
43
.github/workflows/tramline-release.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
name: Android release build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
versionName:
|
||||
description: 'User-facing release version name'
|
||||
required: true
|
||||
default: ""
|
||||
versionCode:
|
||||
description: 'versionCode or build number'
|
||||
required: true
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
signed-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 18
|
||||
|
||||
- name: Build release app
|
||||
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0
|
||||
env:
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
ORG_GRADLE_PROJECT_VERSION_NAME: ${{ github.event.inputs.versionName }}
|
||||
ORG_GRADLE_PROJECT_VERSION_CODE: ${{ github.event.inputs.versionCode }}
|
||||
with:
|
||||
arguments: --no-configuration-cache --stacktrace collectReleaseBundle
|
||||
gradle-home-cache-cleanup: true
|
||||
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
- name: Upload app bundle
|
||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
||||
with:
|
||||
name: release-aab
|
||||
path: android/build/outputs/bundle/release/android-release.aab
|
|
@ -37,13 +37,23 @@ class VersioningPlugin : Plugin<Project> {
|
|||
val contents = providers.fileContents(propFile).asText
|
||||
val versionProps = Properties().also { it.load(contents.get().byteInputStream()) }
|
||||
val versionName =
|
||||
requireNotNull(versionProps.getProperty(VERSIONING_PROP_VERSION_NAME)) {
|
||||
"version.properties must contain a '$VERSIONING_PROP_VERSION_NAME' property"
|
||||
}
|
||||
providers
|
||||
.gradleProperty("VERSION_NAME")
|
||||
.orElse(
|
||||
requireNotNull(versionProps.getProperty(VERSIONING_PROP_VERSION_NAME)) {
|
||||
"version.properties must contain a '$VERSIONING_PROP_VERSION_NAME' property"
|
||||
}
|
||||
)
|
||||
val versionCode =
|
||||
requireNotNull(versionProps.getProperty(VERSIONING_PROP_VERSION_CODE).toInt()) {
|
||||
"version.properties must contain a '$VERSIONING_PROP_VERSION_CODE' property"
|
||||
}
|
||||
providers
|
||||
.gradleProperty("VERSION_CODE")
|
||||
.orElse(
|
||||
requireNotNull(versionProps.getProperty(VERSIONING_PROP_VERSION_CODE)) {
|
||||
"version.properties must contain a '$VERSIONING_PROP_VERSION_CODE' property"
|
||||
}
|
||||
)
|
||||
.map(String::toInt)
|
||||
|
||||
project.plugins.withType<AppPlugin> {
|
||||
androidAppPluginApplied.set(true)
|
||||
extensions.configure<ApplicationAndroidComponentsExtension> {
|
||||
|
@ -57,30 +67,30 @@ class VersioningPlugin : Plugin<Project> {
|
|||
}
|
||||
}
|
||||
}
|
||||
val version = Version.parse(versionName)
|
||||
val version = versionName.map(Version::parse)
|
||||
tasks.register<VersioningTask>("clearPreRelease") {
|
||||
description = "Remove the pre-release suffix from the version"
|
||||
semverString.set(version.toStableVersion().toString())
|
||||
semverString.set(version.get().toStableVersion().toString())
|
||||
propertyFile.set(propFile)
|
||||
}
|
||||
tasks.register<VersioningTask>("bumpMajor") {
|
||||
description = "Increment the major version"
|
||||
semverString.set(version.nextMajorVersion().toString())
|
||||
semverString.set(version.get().nextMajorVersion().toString())
|
||||
propertyFile.set(propFile)
|
||||
}
|
||||
tasks.register<VersioningTask>("bumpMinor") {
|
||||
description = "Increment the minor version"
|
||||
semverString.set(version.nextMinorVersion().toString())
|
||||
semverString.set(version.get().nextMinorVersion().toString())
|
||||
propertyFile.set(propFile)
|
||||
}
|
||||
tasks.register<VersioningTask>("bumpPatch") {
|
||||
description = "Increment the patch version"
|
||||
semverString.set(version.nextPatchVersion().toString())
|
||||
semverString.set(version.get().nextPatchVersion().toString())
|
||||
propertyFile.set(propFile)
|
||||
}
|
||||
tasks.register<VersioningTask>("bumpSnapshot") {
|
||||
description = "Increment the minor version and add the `SNAPSHOT` suffix"
|
||||
semverString.set(version.nextMinorVersion("SNAPSHOT").toString())
|
||||
semverString.set(version.get().nextMinorVersion("SNAPSHOT").toString())
|
||||
propertyFile.set(propFile)
|
||||
}
|
||||
afterEvaluate {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue