on: push
name: Test, Build and Release apk
jobs:
  build:
    name: Build APK
    runs-on: k8s
    steps:
    - name: Install prerequisites
      run: |
        sudo apt-get update
        sudo apt-get install -y xz-utils
    - uses: actions/checkout@v4
    - uses: https://github.com/actions/setup-java@v4
      with:
        java-version: '21'
        distribution: 'oracle'
    - uses: https://github.com/subosito/flutter-action@v2
      with:
        channel: stable
        flutter-version: 3.19.0
        cache: true
    - run: flutter config --no-cli-animations
    - run: flutter doctor
    - run: flutter pub get -v
    # - run: flutter test
    - run: flutter build apk --debug --split-per-abi

    # - name: setup go # gitea release action requires go
    #   uses: https://github.com/actions/setup-go@v4
    #   with:
    #     go-version: '>=1.20.1'
    # - name: Push APK to Releases
    #   uses: https://gitea.com/actions/release-action@main
    #   with:
    #     files: |-
    #       build/app/outputs/**.apk
    #     api_key: '${{secrets.RELEASE_TOKEN}}'