Build and Attach APKs on Release #3
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: Build and Attach APKs on Release | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: # This allows the workflow to be triggered manually | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository at the release's tag | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history to get the release tag | |
ref: ${{ github.event.release.tag_name }} | |
# Step 2: Set up Java 17 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# Step 3: Set up Flutter 3.13.0 | |
- name: Install Flutter 3.13.0 | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.13.0' | |
# Step 4: Build the APKs | |
- name: Build APKs | |
run: flutter build apk --split-per-abi --no-fatal-warnings | |
# Step 5: Upload the APKs as release assets | |
- name: Upload APKs | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | |
asset_name: app-arm64-v8a-release.apk | |
asset_content_type: application/vnd.android.package-archive | |
- name: Upload APK (armeabi-v7a) | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk | |
asset_name: app-armeabi-v7a-release.apk | |
asset_content_type: application/vnd.android.package-archive | |
- name: Upload APK (x86_64) | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: build/app/outputs/flutter-apk/app-x86_64-release.apk | |
asset_name: app-x86_64-release.apk | |
asset_content_type: application/vnd.android.package-archive |