Skip to content

diff approach

diff approach #1019

# This implementation is based on:
# https://www.matijanovosel.com/blog/deploying-flutter-applications-to-google-play-using-github-actions
# name: Flutter Android
# on:
# push:
# branches: [master]
# jobs:
# version:
# name: Create version number
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Fetch all history for all tags and branches
# run: |
# git config remote.origin.url https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
# git fetch --prune --depth=10000
# - name: Install GitVersion
# uses: gittools/actions/gitversion/setup@v0.9.7
# with:
# versionSpec: "5.x"
# - name: Use GitVersion
# id: gitversion
# uses: gittools/actions/gitversion/execute@v0.9.7
# - name: Create version.txt with nuGetVersion
# run: echo ${{ steps.gitversion.outputs.nuGetVersion }} > version.txt
# - name: Upload version.txt
# uses: actions/upload-artifact@v2
# with:
# name: gitversion
# path: version.txt
# build:
# name: Build APK and Create release
# needs: [version]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Get version.txt
# uses: actions/download-artifact@v2
# with:
# name: gitversion
# - name: Create new file without newline char from version.txt
# run: tr -d '\n' < version.txt > version1.txt
# - name: Read version
# id: version
# uses: juliangruber/read-file-action@v1
# with:
# path: version1.txt
# - name: Update version in YAML
# run: sed -i 's/99.99.99+99/${{ steps.version.outputs.content }}+${{ github.run_number }}/g' pubspec.yaml
# - name: Update KeyStore password in gradle properties
# run: sed -i 's/#{KEYSTORE_PASS}#/${{ secrets.KEYSTORE_PASS }}/g' android/key.properties
# - name: Update KeyStore key password in gradle properties
# run: sed -i 's/#{KEYSTORE_KEY_PASS}#/${{ secrets.KEYSTORE_KEY_PASS }}/g' android/key.properties
# - uses: actions/setup-java@v1
# with:
# java-version: "12.x"
# - uses: subosito/flutter-action@v1
# with:
# channel: "beta"
# - run: flutter clean
# - run: flutter pub get
# - run: flutter build apk --release --split-per-abi
# - run: flutter build appbundle --release
# - name: Create a Release in GitHub
# uses: ncipollo/release-action@v1
# with:
# artifacts: "build/app/outputs/apk/release/*.apk,build/app/outputs/bundle/release/app-release.aab"
# token: ${{ secrets.GH_TOKEN }}
# tag: ${{ steps.version.outputs.content }}
# commit: ${{ github.sha }}
# - name: Upload app bundle
# uses: actions/upload-artifact@v2
# with:
# name: appbundle
# path: build/app/outputs/bundle/release/app-release.aab
# release:
# name: Release app to internal track
# needs: [build]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Get appbundle from artifacts
# uses: actions/download-artifact@v2
# with:
# name: appbundle
# - name: Release app to internal track
# uses: r0adkll/upload-google-play@v1
# with:
# serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}
# packageName: io.jonline.jonline
# releaseFiles: app-release.aab
# track: alpha
# status: completed
# Old implementation
name: Flutter Android
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build_android:
name: Build
# This job is known to fail.
continue-on-error: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
# with:
# flutter-version: '3.7.7'
- working-directory: frontends/flutter
run: flutter pub get
- working-directory: frontends/flutter
run: flutter build apk
- working-directory: frontends/flutter
run: flutter build appbundle