fix: tasker launch of shortcuts (#290)
This commit is contained in:
parent
a5e9aa83b8
commit
594834a908
|
@ -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,31 @@ 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
|
||||||
|
gh release delete ${{ github.event.inputs.tag_name }} --yes || true
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -164,7 +169,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
body: |
|
body: |
|
||||||
${{ env.RELEASE_NOTES }}
|
${{ env.RELEASE_NOTES }}
|
||||||
|
|
||||||
SHA256 fingerprint:
|
SHA256 fingerprint:
|
||||||
```${{ steps.checksum.outputs.checksum }}```
|
```${{ steps.checksum.outputs.checksum }}```
|
||||||
tag_name: ${{ env.TAG_NAME }}
|
tag_name: ${{ env.TAG_NAME }}
|
||||||
|
|
|
@ -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,22 @@ 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 {
|
||||||
"-${grgitService.service.get().grgit.head().abbreviatedId}"
|
contains(Constants.NIGHTLY) || contains(Constants.PRERELEASE) ->
|
||||||
} else {
|
Constants.VERSION_NAME +
|
||||||
Constants.VERSION_NAME
|
"-${grgitService.service.get().grgit.head().abbreviatedId}"
|
||||||
|
else -> Constants.VERSION_NAME
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,11 +86,15 @@
|
||||||
android:name="com.journeyapps.barcodescanner.CaptureActivity"
|
android:name="com.journeyapps.barcodescanner.CaptureActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
tools:replace="screenOrientation" />
|
tools:replace="screenOrientation" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".service.shortcut.ShortcutsActivity"
|
android:name=".service.shortcut.ShortcutsActivity"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:finishOnTaskLaunch="true"
|
android:noHistory="true"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:finishOnTaskLaunch="true"
|
||||||
|
android:launchMode="singleInstance"
|
||||||
android:theme="@android:style/Theme.NoDisplay" />
|
android:theme="@android:style/Theme.NoDisplay" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
|
@ -174,4 +178,4 @@
|
||||||
android:name=".receiver.NotificationActionReceiver"
|
android:name=".receiver.NotificationActionReceiver"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
object Constants {
|
object Constants {
|
||||||
const val VERSION_NAME = "3.4.8"
|
const val VERSION_NAME = "3.4.8"
|
||||||
const val JVM_TARGET = "17"
|
const val JVM_TARGET = "17"
|
||||||
const val VERSION_CODE = 34800
|
const val VERSION_CODE = 34800
|
||||||
const val TARGET_SDK = 34
|
const val TARGET_SDK = 34
|
||||||
|
@ -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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,10 @@ android {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create(Constants.PRERELEASE) {
|
||||||
|
initWith(getByName(Constants.RELEASE))
|
||||||
|
}
|
||||||
|
|
||||||
create(Constants.NIGHTLY) {
|
create(Constants.NIGHTLY) {
|
||||||
initWith(getByName(Constants.RELEASE))
|
initWith(getByName(Constants.RELEASE))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue