Skip to content

update master workflow to be able to build release bundle #22

update master workflow to be able to build release bundle

update master workflow to be able to build release bundle #22

name: Flutter CI
on:
push:
branches:
- master
jobs:
test:
# This job will run on ubuntu virtual machine
runs-on: ubuntu-latest
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
# Setup the flutter environment.
- uses: subosito/flutter-action@v1
with:
channel: 'stable' # 'dev', 'alpha', default to: 'stable'
# flutter-version: '1.12.x' # you can also specify exact version of flutter
# Get flutter dependencies.
- run: flutter pub get
# Check for any formatting issues in the code.
- run: flutter format --set-exit-if-changed .
# Generate mocks
- run: flutter pub run build_runner build
# Statically analyze the Dart code for any errors.
- run: flutter analyze .
# Run widget tests for our flutter project.
- run: flutter test
build_android:
runs-on: ubuntu-latest
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
# Setup the flutter environment.
- uses: subosito/flutter-action@v1
with:
channel: 'stable' # 'dev', 'alpha', default to: 'stable'
# flutter-version: '1.12.x' # you can also specify exact version of flutter
# Get flutter dependencies.
- run: flutter pub get
# Generate the keystore file
- name: Decode keystore file
env:
CERTIFICATE_BASE64: ${{ secrets.STORE_FILE_CONTENT }}
run: echo $CERTIFICATE_BASE64 | base64 --decode > android/app/my-keystore.jks
- name: Create temporary key.properties
run: |
echo "storeFile=my-keystore.jks" > android/key.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
# Generate the .env file
- name: Generate .env file
env:
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
run: echo "spotify_client_id=SPOTIFY_CLIENT_ID" > .env
# Build Android release
- run: flutter build appbundle --release
- uses: actions/upload-artifact@v2
with:
name: android-release
path: build/app/outputs/bundle/release/app-release.aab
build_ios:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- run: flutter pub get
- run: flutter build ios --release --no-codesign
- name: Upload iPA
uses: actions/upload-artifact@v2
with:
name: ios-release
path: build/ios/iphoneos
release:
needs: [test, build_android, build_ios]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: ios-release
- uses: actions/download-artifact@v2
with:
name: android-release
- uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
packageName: com.example.flutter_app
releaseFiles: app-release.aab
track: internal
# TODO upload to app store