Skip to content

Create CI/CD workflow #3

Create CI/CD workflow

Create CI/CD workflow #3

name: Flutter Build and Release
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17' # Changed from '11' to '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.3'
channel: 'stable'
- name: Get dependencies
run: flutter pub get
- name: Build APK
run: flutter build apk --release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: v0.${{ github.run_number }}
release_name: Release 0.${{ github.run_number }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/app/outputs/flutter-apk/app-release.apk
asset_name: freelexity-v0.${{ github.run_number }}.apk
asset_content_type: application/vnd.android.package-archive