Flutter Project With CI CD

Example project https://github.com/nabilnalakath/flutter-githubaction

The guid is here: https://medium.com/better-programming/ci-cd-for-flutter-apps-using-github-actions-b833f8f7aac

项目下建立目录

mkdir -p .github/workflows

建立文件 main.yml

on: push
name: Test, Build and Release apk
jobs:
  build:
    name: Build APK
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
      - uses: actions/[email protected]
        with:
          java-version: "12.x"
      - uses: subosito/[email protected]
        with:
          flutter-version: "1.7.8+hotfix.4"
      - run: flutter pub get
      - run: flutter test
      - run: flutter build apk --debug --split-per-abi
      - name: Push APK to Releases
        uses: ncipollo/[email protected]
        with:
          artifacts: "build/app/outputs/apk/debug/*.apk"
          token: ${{ secrets.TOKEN }}

apk 签名:

https://github.com/marketplace/actions/sign-android-release

可以不用签名, 只用于测试.