Prepare Android 1.0.0 release #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| workflow_dispatch: | |
| inputs: | |
| publish_release: | |
| description: Publish a GitHub release | |
| required: true | |
| type: boolean | |
| default: false | |
| tag_name: | |
| description: Release tag | |
| required: true | |
| default: v1.0.0 | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: android-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CI: true | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| JAVA_TOOL_OPTIONS: -Djava.awt.headless=true | |
| GRADLE_OPTS: -Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Djava.awt.headless=true | |
| jobs: | |
| debug-apk: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 26 | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches/modules-2 | |
| ~/.gradle/caches/transforms-* | |
| ~/.gradle/wrapper | |
| key: gradle-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml', '**/*.gradle.kts') }} | |
| restore-keys: gradle-${{ runner.os }}- | |
| - name: Build debug APK | |
| timeout-minutes: 15 | |
| run: ./gradlew --no-daemon --no-parallel --stacktrace :app:assembleDebug | |
| - name: Upload debug APK | |
| if: ${{ github.ref != 'refs/heads/main' }} | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: typetype-debug-apk | |
| path: app/build/outputs/apk/debug/*.apk | |
| if-no-files-found: error | |
| retention-days: 14 | |
| lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 26 | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches/modules-2 | |
| ~/.gradle/caches/transforms-* | |
| ~/.gradle/wrapper | |
| key: gradle-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml', '**/*.gradle.kts') }} | |
| restore-keys: gradle-${{ runner.os }}- | |
| - name: Run lint | |
| timeout-minutes: 15 | |
| run: ./gradlew --no-daemon --no-parallel --stacktrace lint | |
| - name: Upload lint report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: lint-report | |
| path: app/build/reports/lint-results-debug.html | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 26 | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches/modules-2 | |
| ~/.gradle/caches/transforms-* | |
| ~/.gradle/wrapper | |
| key: gradle-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml', '**/*.gradle.kts') }} | |
| restore-keys: gradle-${{ runner.os }}- | |
| - name: Run unit tests | |
| timeout-minutes: 10 | |
| run: ./gradlew --no-daemon --no-parallel --stacktrace :app:testDebugUnitTest | |
| release: | |
| needs: | |
| - debug-apk | |
| - lint | |
| - unit-tests | |
| if: ${{ github.ref == 'refs/heads/main' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish_release)) }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 35 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 26 | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches/modules-2 | |
| ~/.gradle/caches/transforms-* | |
| ~/.gradle/wrapper | |
| key: gradle-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml', '**/*.gradle.kts') }} | |
| restore-keys: gradle-${{ runner.os }}- | |
| - name: Prepare release tag | |
| env: | |
| INPUT_TAG_NAME: ${{ inputs.tag_name }} | |
| run: | | |
| if [ -n "$INPUT_TAG_NAME" ]; then | |
| echo "RELEASE_TAG=$INPUT_TAG_NAME" >> "$GITHUB_ENV" | |
| else | |
| echo "RELEASE_TAG=v1.0.0" >> "$GITHUB_ENV" | |
| fi | |
| - name: Prepare signing | |
| env: | |
| ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
| ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
| ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
| run: | | |
| test -n "$ANDROID_KEYSTORE_BASE64" | |
| test -n "$ANDROID_KEYSTORE_PASSWORD" | |
| test -n "$ANDROID_KEY_ALIAS" | |
| test -n "$ANDROID_KEY_PASSWORD" | |
| printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 --decode > release.keystore | |
| { | |
| printf 'storeFile=%s\n' "$PWD/release.keystore" | |
| printf 'storePassword=%s\n' "$ANDROID_KEYSTORE_PASSWORD" | |
| printf 'keyAlias=%s\n' "$ANDROID_KEY_ALIAS" | |
| printf 'keyPassword=%s\n' "$ANDROID_KEY_PASSWORD" | |
| } > keystore.properties | |
| - name: Build release APK | |
| timeout-minutes: 25 | |
| run: ./gradlew --no-daemon --no-parallel --stacktrace :app:assembleRelease | |
| - name: Prepare APK artifact | |
| run: | | |
| mkdir -p artifacts | |
| apk="$(find app/build/outputs/apk/release -name '*.apk' | head -n 1)" | |
| test -n "$apk" | |
| cp "$apk" "artifacts/TypeType-Android-$RELEASE_TAG.apk" | |
| - name: Upload release APK | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: typetype-release-apk | |
| path: artifacts/*.apk | |
| if-no-files-found: error | |
| retention-days: 30 | |
| - name: Publish GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.RELEASE_TAG }} | |
| name: TypeType Android ${{ env.RELEASE_TAG }} | |
| files: artifacts/*.apk | |
| fail_on_unmatched_files: true |