Skip to content

Instantly share code, notes, and snippets.

@AjinkyaTaranekar
Created May 31, 2021 09:40
Show Gist options
  • Save AjinkyaTaranekar/81d59a72ad387f35ed9c2b2bd1f756d3 to your computer and use it in GitHub Desktop.
Save AjinkyaTaranekar/81d59a72ad387f35ed9c2b2bd1f756d3 to your computer and use it in GitHub Desktop.
GitHub Actions workflow to build Flutter app and create Release, put this file under `.github/workflows` folder.
on:
push:
branches:
- master
name: Build and Release Apps
jobs:
build:
name: Build Apps
runs-on: macos-latest
steps:
- name: Export Release Timestamp
run: echo "APP_VERSION=release_$(date +'%Y-%m-%d_%H-%m-%S')" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v1
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: "12.x"
- name: Set up Flutter
uses: subosito/flutter-action@v1
with:
channel: "stable"
- name: Install pub Dependencies
run: flutter pub get
- name: Run Tests
run: flutter test
- name: Build Android App
run: flutter build apk --split-per-abi
- name: Build iOS App
run: |
flutter build ios --no-codesign
cd build/ios/iphoneos
mkdir Payload
cd Payload
ln -s ../Runner.app
cd ..
zip -r app.ipa Payload
- name: Build Web App
run: |
flutter build web
cd build/web
zip -r web-app.zip .
- name: Release Apps
uses: ncipollo/release-action@v1
with:
tag: ${{ env.APP_VERSION }}
name: ${{ env.APP_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "build/app/outputs/apk/release/*.apk,build/ios/iphoneos/app.ipa,build/web/web-app.zip"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment