Created
June 12, 2022 17:24
-
-
Save imessenger98/ba1e2520c64abdca0f3b5b8f090d31ef 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.
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
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=v$(date +'%Y.%m.%d.%H.%M.%S')" >> $GITHUB_ENV | |
- name: Checkout repository | |
uses: actions/checkout@v1 | |
- name: Set up Java | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '15' | |
distribution: 'adopt' | |
- 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