Skip to content

trigger-ga___attach_debug_apk_to_release.yml #1

trigger-ga___attach_debug_apk_to_release.yml

trigger-ga___attach_debug_apk_to_release.yml #1

jobs:
attach-apks:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: self-hosted
steps:
- continue-on-error: true
name: Clone repository
uses: actions/checkout@v4
with:
ref: ${{ env.GITHUB_REF }}
- continue-on-error: true
name: Build and attach APK to release
run: "exit_on_error() {\n echo \"$1\"\n echo \"Deleting '$RELEASE_VERSION_NAME'\
\ release and '$GITHUB_REF' tag\"\n hub release delete \"$RELEASE_VERSION_NAME\"\
\n git push --delete origin \"$GITHUB_REF\"\n exit 1\n}\n\necho \"Setting\
\ vars\"\nRELEASE_VERSION_NAME=\"${GITHUB_REF/refs\\/tags\\//}\"\nif ! printf\
\ \"%s\" \"${RELEASE_VERSION_NAME/v/}\" | grep -qP '^(0|[1-9]\\d*)\\.(0|[1-9]\\\
d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\\
d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$';\
\ then\n exit_on_error \"The versionName '${RELEASE_VERSION_NAME/v/}' is\
\ not a valid version as per semantic version '2.0.0' spec in the format 'major.minor.patch(-prerelease)(+buildmetadata)'.\
\ https://semver.org/spec/v2.0.0.html.\"\nfi\n\nAPK_DIR_PATH=\"./app/build/outputs/apk/debug\"\
\nAPK_VERSION_TAG=\"$RELEASE_VERSION_NAME+github-debug\"\nAPK_BASENAME_PREFIX=\"\
termux-tasker_$APK_VERSION_TAG\"\n\necho \"Building APK for '$RELEASE_VERSION_NAME'\
\ release\"\nexport TERMUX_TASKER_APK_VERSION_TAG=\"$APK_VERSION_TAG\" # Used\
\ by app/build.gradle\nif ! ./gradlew assembleDebug; then\n exit_on_error\
\ \"Build failed for '$RELEASE_VERSION_NAME' release.\"\nfi\n\necho \"Validating\
\ APK\"\nif ! test -f \"$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk\"; then\n\
\ files_found=\"$(ls \"$APK_DIR_PATH\")\"\n exit_on_error \"Failed to find\
\ built APK at '$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk'. Files found: \"\
$'\\n'\"$files_found\"\nfi\n\necho \"Generating sha25sums file\"\nif ! (cd\
\ \"$APK_DIR_PATH\"; sha256sum \"${APK_BASENAME_PREFIX}.apk\" > sha256sums);\
\ then\n exit_on_error \"Generate sha25sums failed for '$RELEASE_VERSION_NAME'\
\ release.\"\nfi\n\necho \"Attaching APK to github release\"\nif ! hub release\
\ edit \\\n-m \"\" \\\n-a \"$APK_DIR_PATH/${APK_BASENAME_PREFIX}.apk\" \\\n\
-a \"$APK_DIR_PATH/sha256sums\" \\\n\"$RELEASE_VERSION_NAME\"; then\n exit_on_error\
\ \"Attach APK to release failed for '$RELEASE_VERSION_NAME' release.\"\n\
fi\n"
shell: bash {0}
name: Attach Debug APK To Release
on:
repository_dispatch:
types: trigger-ga___attach_debug_apk_to_release.yml