Skip to content

Instantly share code, notes, and snippets.

@gauravssnl
Created March 9, 2020 19:30
Show Gist options
  • Save gauravssnl/c8edd0776720dd9d866506170c337ce2 to your computer and use it in GitHub Desktop.
Save gauravssnl/c8edd0776720dd9d866506170c337ce2 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 "::set-env name=APP_VERSION::release_$(date +'%Y-%m-%d_%H-%m-%S')"
- 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: 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"
@sank8dalvi
Copy link

set-env is deprecated in github actions and thus Export Release Timestamp is giving a error.
You can make changes according to the new environment file handling on github
Please update the run command with the following new syntax to fix it.

echo "APP_VERSION=release_$(date +'%Y-%m-%d_%H-%m-%S')" >> $GITHUB_ENV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment