add prerelease build type
This commit is contained in:
parent
7e73e5150c
commit
70c9499a8c
|
@ -86,9 +86,12 @@ jobs:
|
||||||
# Build and sign APK ("-x test" argument is used to skip tests)
|
# Build and sign APK ("-x test" argument is used to skip tests)
|
||||||
# add fdroid flavor for apk upload
|
# add fdroid flavor for apk upload
|
||||||
- name: Build Fdroid Release APK
|
- name: Build Fdroid Release APK
|
||||||
if: ${{ inputs.release_type != '' && inputs.release_type != 'nightly' }}
|
if: ${{ inputs.release_type != '' && inputs.release_type == 'release' }}
|
||||||
run: ./gradlew :app:assembleFdroidRelease -x test
|
run: ./gradlew :app:assembleFdroidRelease -x test
|
||||||
|
|
||||||
|
- name: Build Fdroid Prerelease APK
|
||||||
|
if: ${{ inputs.release_type != '' && inputs.release_type == 'prerelease' }}
|
||||||
|
run: ./gradlew :app:assembleFdroidPrerelease -x test
|
||||||
|
|
||||||
- name: Build Fdroid Nightly APK
|
- name: Build Fdroid Nightly APK
|
||||||
if: ${{ inputs.release_type == '' || inputs.release_type == 'nightly' }}
|
if: ${{ inputs.release_type == '' || inputs.release_type == 'nightly' }}
|
||||||
|
@ -96,11 +99,13 @@ jobs:
|
||||||
|
|
||||||
- if: ${{ inputs.release_type == '' || inputs.release_type == 'nightly' }}
|
- if: ${{ inputs.release_type == '' || inputs.release_type == 'nightly' }}
|
||||||
run: echo "APK_PATH=$(find . -regex '^.*/build/outputs/apk/fdroid/nightly/.*\.apk$' -type f | head -1)" >> $GITHUB_ENV
|
run: echo "APK_PATH=$(find . -regex '^.*/build/outputs/apk/fdroid/nightly/.*\.apk$' -type f | head -1)" >> $GITHUB_ENV
|
||||||
- if: ${{ inputs.release_type != '' && inputs.release_type != 'nightly' }}
|
- if: ${{ inputs.release_type != '' && inputs.release_type == 'release' }}
|
||||||
run: echo "APK_PATH=$(find . -regex '^.*/build/outputs/apk/fdroid/release/.*\.apk$' -type f | head -1)" >> $GITHUB_ENV
|
run: echo "APK_PATH=$(find . -regex '^.*/build/outputs/apk/fdroid/release/.*\.apk$' -type f | head -1)" >> $GITHUB_ENV
|
||||||
|
- if: ${{ inputs.release_type != '' && inputs.release_type == 'prerelease' }}
|
||||||
|
run: echo "APK_PATH=$(find . -regex '^.*/build/outputs/apk/fdroid/prerelease/.*\.apk$' -type f | head -1)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Get version code
|
- name: Get version code
|
||||||
if: ${{ inputs.release_type == 'release' || inputs.release_type == 'prerelease' }}
|
if: ${{ inputs.release_type == 'release' }}
|
||||||
run: |
|
run: |
|
||||||
version_code=$(grep "VERSION_CODE" buildSrc/src/main/kotlin/Constants.kt | awk '{print $5}' | tr -d '\n')
|
version_code=$(grep "VERSION_CODE" buildSrc/src/main/kotlin/Constants.kt | awk '{print $5}' | tr -d '\n')
|
||||||
echo "VERSION_CODE=$version_code" >> $GITHUB_ENV
|
echo "VERSION_CODE=$version_code" >> $GITHUB_ENV
|
||||||
|
@ -126,31 +131,30 @@ jobs:
|
||||||
event-type: fdroid-update
|
event-type: fdroid-update
|
||||||
|
|
||||||
- name: Set version release notes
|
- name: Set version release notes
|
||||||
if: ${{ inputs.release_type == 'release' || inputs.release_type == 'prerelease' }}
|
if: ${{ inputs.release_type == 'release' }}
|
||||||
run: |
|
run: |
|
||||||
RELEASE_NOTES="$(cat ${{ github.workspace }}/fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt)"
|
RELEASE_NOTES="$(cat ${{ github.workspace }}/fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt)"
|
||||||
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
|
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
|
||||||
echo "$RELEASE_NOTES" >> $GITHUB_ENV
|
echo "$RELEASE_NOTES" >> $GITHUB_ENV
|
||||||
echo "EOF" >> $GITHUB_ENV
|
echo "EOF" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: On nightly release
|
- name: On nightly release notes
|
||||||
if: ${{ contains(env.TAG_NAME, 'nightly') }}
|
if: ${{ contains(env.TAG_NAME, 'nightly') }}
|
||||||
run: |
|
run: |
|
||||||
echo "RELEASE_NOTES=Nightly build for the latest development version of the app." >> $GITHUB_ENV
|
echo "RELEASE_NOTES=Nightly build for the latest development version of the app." >> $GITHUB_ENV
|
||||||
gh release delete nightly --yes || true
|
gh release delete nightly --yes || true
|
||||||
|
|
||||||
|
- name: On prerelease release notes
|
||||||
|
if: ${{ inputs.release_type == 'prerelease' }}
|
||||||
|
run: |
|
||||||
|
echo "RELEASE_NOTES=Testing version of app for specific feature." >> $GITHUB_ENV
|
||||||
|
|
||||||
# Setup TAG_NAME, which is used as a general "name"
|
# Setup TAG_NAME, which is used as a general "name"
|
||||||
- if: github.event_name == 'workflow_dispatch'
|
- if: github.event_name == 'workflow_dispatch'
|
||||||
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
|
||||||
- if: github.event_name == 'schedule'
|
- if: github.event_name == 'schedule'
|
||||||
run: echo "TAG_NAME=nightly" >> $GITHUB_ENV
|
run: echo "TAG_NAME=nightly" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: On nightly release
|
|
||||||
if: ${{ contains(env.TAG_NAME, 'nightly') }}
|
|
||||||
run: |
|
|
||||||
echo "RELEASE_NOTES=Nightly build of the latest development version of the android client." >> $GITHUB_ENV
|
|
||||||
gh release delete nightly --yes || true
|
|
||||||
|
|
||||||
- name: Get checksum
|
- name: Get checksum
|
||||||
id: checksum
|
id: checksum
|
||||||
run: echo "checksum=$(apksigner verify -print-certs ${{ env.APK_PATH }} | grep -Po "(?<=SHA-256 digest:) .*" | tr -d "[:blank:]")" >> $GITHUB_OUTPUT
|
run: echo "checksum=$(apksigner verify -print-certs ${{ env.APK_PATH }} | grep -Po "(?<=SHA-256 digest:) .*" | tr -d "[:blank:]")" >> $GITHUB_OUTPUT
|
||||||
|
|
|
@ -60,6 +60,10 @@ android {
|
||||||
}
|
}
|
||||||
debug { isDebuggable = true }
|
debug { isDebuggable = true }
|
||||||
|
|
||||||
|
create(Constants.PRERELEASE) {
|
||||||
|
initWith(buildTypes.getByName(Constants.RELEASE))
|
||||||
|
}
|
||||||
|
|
||||||
create(Constants.NIGHTLY) {
|
create(Constants.NIGHTLY) {
|
||||||
initWith(buildTypes.getByName(Constants.RELEASE))
|
initWith(buildTypes.getByName(Constants.RELEASE))
|
||||||
}
|
}
|
||||||
|
@ -184,19 +188,21 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun determineVersionCode(): Int {
|
fun determineVersionCode(): Int {
|
||||||
return if (isNightlyBuild()) {
|
return with(getBuildTaskName().lowercase()) {
|
||||||
Constants.VERSION_CODE +
|
when {
|
||||||
Constants.NIGHTLY_CODE
|
contains(Constants.NIGHTLY) -> Constants.VERSION_CODE + Constants.NIGHTLY_CODE
|
||||||
} else {
|
contains(Constants.PRERELEASE) -> Constants.VERSION_CODE + Constants.PRERELEASE_CODE
|
||||||
Constants.VERSION_CODE
|
else -> Constants.VERSION_CODE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun determineVersionName(): String {
|
fun determineVersionName(): String {
|
||||||
return if (isNightlyBuild()) {
|
return with(getBuildTaskName().lowercase()) {
|
||||||
Constants.VERSION_NAME +
|
when {
|
||||||
|
contains(Constants.NIGHTLY) || contains(Constants.PRERELEASE) -> Constants.VERSION_NAME +
|
||||||
"-${grgitService.service.get().grgit.head().abbreviatedId}"
|
"-${grgitService.service.get().grgit.head().abbreviatedId}"
|
||||||
} else {
|
else -> Constants.VERSION_NAME
|
||||||
Constants.VERSION_NAME
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,10 @@ object Constants {
|
||||||
|
|
||||||
const val RELEASE = "release"
|
const val RELEASE = "release"
|
||||||
const val NIGHTLY = "nightly"
|
const val NIGHTLY = "nightly"
|
||||||
|
const val PRERELEASE = "prerelease"
|
||||||
const val DEBUG = "debug"
|
const val DEBUG = "debug"
|
||||||
const val TYPE = "type"
|
const val TYPE = "type"
|
||||||
|
|
||||||
const val NIGHTLY_CODE = 42
|
const val NIGHTLY_CODE = 42
|
||||||
|
const val PRERELEASE_CODE = 99
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,10 @@ fun Project.getCurrentFlavor(): String {
|
||||||
return flavor
|
return flavor
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.isNightlyBuild(): Boolean {
|
fun Project.getBuildTaskName(): String {
|
||||||
val taskRequestsStr = gradle.startParameter.taskRequests[0].toString()
|
val taskRequestsStr = gradle.startParameter.taskRequests[0].toString()
|
||||||
return taskRequestsStr.lowercase().contains(Constants.NIGHTLY).also {
|
return taskRequestsStr.also {
|
||||||
project.logger.lifecycle("Nightly build: $it")
|
project.logger.lifecycle("Build task: $it")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue