name: android on: workflow_dispatch: push: branches: - main paths: - "lib/**" - "android/**" - "pubspec.yaml" - "pubspec.lock" - ".github/workflows/android.yml" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: contents: "read" id-token: "write" jobs: build: runs-on: blacksmith-4vcpu-ubuntu-2404 steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup JDK 17 uses: actions/setup-java@v4 with: distribution: "temurin" cache: "gradle" java-version: 17 - name: Setup Flutter uses: subosito/flutter-action@v2 with: channel: "stable" flutter-version: 3.47.2 cache: true - name: Generated code setup run: | flutter pub get dart run build_runner build --delete-conflicting-outputs - name: Setup keys uses: timheuer/base64-to-file@v1 with: fileName: "keystore/upload_key.jks" encodedString: ${{ secrets.SIGNING_KEY_BASE64 }} - name: Setup env run: | echo "VIDEO_SERVICE_URL=https://video.sprk.so" >> .env echo "SPRK_APPVIEW_URL=https://api.sprk.so" >> .env echo "MESSAGES_SERVICE_URL=https://api.sprk.chat" >> .env echo "SHOWCASES_LICENSE_FLUTTER=${{ secrets.SHOWCASES_LICENSE_FLUTTER }}" >> .env echo "SIGNUPS_DISABLED=false" >> .env # Set versionCode (run number) START_VERSION_CODE=4300 VERSION_CODE=$((START_VERSION_CODE + ${{ github.run_number }})) sed -i "s/^\(version:.*\)+[0-9]*\$/\1+${VERSION_CODE}/" pubspec.yaml echo "Using versionCode: $VERSION_CODE" - name: Configure Keystore run: | echo "storeFile=$RUNNER_TEMP/keystore/upload_key.jks" >> key.properties echo "storePassword=${{ secrets.SIGNING_STORE_PASSWORD }}" >> key.properties echo "keyAlias=${{ secrets.SIGNING_KEY_ALIAS }}" >> key.properties echo "keyPassword=${{ secrets.SIGNING_KEY_PASSWORD }}" >> key.properties working-directory: android - name: Build PlayStore AAB env: POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} timeout-minutes: 30 run: | flutter build appbundle - name: Upload AAB to PlayStore uses: r0adkll/upload-google-play@v1 with: serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} packageName: so.sprk.app releaseFiles: build/app/outputs/bundle/release/app-release.aab track: internal