Android CI #7
This file contains 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 CI | |
permissions: | |
contents: write | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Application version' | |
required: true | |
default: '1.0.0' | |
prerelease: | |
description: 'Pre-Release?' | |
required: true | |
default: false | |
jobs: | |
build: | |
name: Build Signed APK | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Decode Keystore | |
id: decode_keystore | |
uses: timheuer/[email protected] | |
with: | |
fileName: 'android_keystore.jks' | |
fileDir: '/home/runner/work/RecurringExpenseTracker/RecurringExpenseTracker/app/keystore/' | |
encodedString: ${{ secrets.KEYSTORE }} | |
- name: Build APK | |
run: ./gradlew :app:assembleRelease -x test | |
env: | |
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
- name: Verify Signature | |
run: $ANDROID_SDK_ROOT/build-tools/34.0.0/apksigner verify --print-certs app/build/outputs/apk/release/RecurringExpenseTracker_${{ github.event.inputs.version }}.apk | |
- name: Upload APK | |
uses: actions/[email protected] | |
with: | |
name: RecurringExpenseTracker | |
path: app/build/outputs/apk/release/RecurringExpenseTracker_${{ github.event.inputs.version }}.apk | |
release: | |
name: Release APK | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download APK from build | |
uses: actions/download-artifact@v1 | |
with: | |
name: RecurringExpenseTracker | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ github.event.inputs.version }} | |
name: Release v${{ github.event.inputs.version }} | |
draft: false | |
prerelease: ${{ github.event.inputs.prerelease }} | |
files: RecurringExpenseTracker/RecurringExpenseTracker_${{ github.event.inputs.version }}.apk |