Release Android #6
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: Release Android | |
on: | |
workflow_dispatch: | |
jobs: | |
build_android: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'beta' | |
# flutter-version: latest | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache | |
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path | |
architecture: x64 # optional, x64 or arm64 | |
- run: flutter --version | |
- name: Build for Android | |
run: flutter build apk --release | |
- name: Key base64 to file | |
uses: timheuer/[email protected] | |
with: | |
fileName: 'android_key.jks' | |
fileDir: '/tmp/.android_key/' | |
encodedString: ${{ secrets.ANDROID_KEY_BASE64 }} | |
- name: Install apksigner | |
run: sudo apt install apksigner | |
- name: Sign apk | |
env: | |
ANDROID_KS_PASS: ${{ secrets.ANDROID_KS_PASS }} | |
run: | | |
for file in build/app/outputs/flutter-apk/*.apk; do | |
filename="${file##*/}" | |
echo "Signing ${filename}" | |
apksigner sign --v4-signing-enabled false --ks /tmp/.android_key/android_key.jks --ks-pass env:ANDROID_KS_PASS --ks-key-alias ${{ secrets.ANDROID_KEY_ALIAS }} ${file} | |
done | |
- name: Upload apk to artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-release.apk | |
path: build/app/outputs/flutter-apk/app-release.apk |