Skip to content

prevent background crash when network error occurs #24

prevent background crash when network error occurs

prevent background crash when network error occurs #24

Workflow file for this run

name: Build, Sign, Release
permissions: write-all
on:
push:
branches:
- trunk
# tags:
# - 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
APP_VERSION=$(grep 'app-versionName' gradle/libs.versions.toml | sed 's/.*= "\(.*\)"/\1/')
echo "RELEASE_VERSION=$APP_VERSION" >> $GITHUB_ENV
- name: Set up JDK env
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 19
cache: 'gradle'
- name: Execute Gradle build
run: ./gradlew --no-daemon --build-cache assembleRelease
- name: Get build tools
run: |
BUILD_TOOLS_PATH=/usr/local/lib/android/sdk/build-tools/$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
echo "BUILD_TOOLS=$BUILD_TOOLS_PATH" >> $GITHUB_ENV
- name: Zipalign the APK
run: |
$BUILD_TOOLS/zipalign -v 4 app/build/outputs/apk/release/app-release-unsigned.apk app-release-unsigned.apk
- name: Sign the APK
run: |
echo "${{ secrets.KEYSTORE }}" > keystore.asc
gpg -d --passphrase "${{ secrets.KEY_PASSWD }}" --batch keystore.asc > keystore.jks
$BUILD_TOOLS/apksigner sign --ks keystore.jks --ks-key-alias ${{ secrets.KEY_ALIAS }} --ks-pass pass:${{ secrets.KEY_PASSWD }} --key-pass pass:${{ secrets.KEY_PASSWD }} --out app-release.apk app-release-unsigned.apk
- name: Verify the APK signature
run: $BUILD_TOOLS/apksigner verify app-release.apk
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: Release ${{ env.RELEASE_VERSION }}
draft: false
prerelease: false
- name: Upload release APK
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app-release.apk
asset_name: linklater-release.apk
asset_content_type: application/vnd.android.package-archive