Skip to content

.github/workflows/android-release.yaml #15

.github/workflows/android-release.yaml

.github/workflows/android-release.yaml #15

name: Android + GitHub Release 🚀
on:
push:
tags:
- 'v*'
permissions:
contents: write
env:
JAVA_VERSION: "21.x"
FLUTTER_VERSION: "3.29.x"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Decode keystore
run: |
echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 --decode > android/app/upload-keystore.jks
- name: Create key.properties
run: |
echo "storeFile=upload-keystore.jks" > android/key.properties
echo "storePassword=${{ secrets.ANDROID_STORE_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties
echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> android/key.properties
- name: Install dependencies
run: flutter pub get
- name: Build appbundle
run: flutter build appbundle
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-aab
path: build/app/outputs/bundle/release/app-release.aab
- name: Build APK
run: flutter build apk --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-apk
path: build/app/outputs/flutter-apk/app-release.apk
deploy:
name: Deploy to Play Store
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: release-aab
path: ./build
- name: Decode service account
run: |
echo "${{ secrets.ANDROID_DEPLOY_KEY }}" | base64 --decode > play-upload-key.json
- name: Upload to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: play-upload-key.json
packageName: com.w8385.my_solved
releaseFiles: ./build/app-release.aab
track: production
status: completed
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: release-apk
path: ./build
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
files: ./build/app-release.apk
generate_release_notes: true
make_latest: true