---
format_version: '11'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
trigger_map:
- push_branch: "*"
  workflow: primary
- pull_request_source_branch: "*"
  workflow: primary
- tag: "*"
  workflow: deploy
workflows:
  deploy:
    steps:
    - activate-ssh-key@4: {}
    - git-clone@6: {}
    - cache-pull@2: {}
    - script@1:
        title: Install newer cmake
        inputs:
        - content: |-
            #!/bin/bash
            set -ex
            sdkmanager --install "cmake;3.18.1"
    - install-missing-android-tools@2.3:
        inputs:
        - gradlew_path: "$PROJECT_LOCATION/gradlew"
    - android-lint@0:
        inputs:
        - project_location: "$PROJECT_LOCATION"
        - module: "$MODULE"
        - variant: "$BUILD_VARIANT"
    - android-build@0:
        inputs:
        - variant: "$BUILD_VARIANT"
        - project_location: "$PROJECT_LOCATION"
        - build_type: aab
    - sign-apk@1:
        run_if: '{{getenv "BITRISEIO_ANDROID_KEYSTORE_URL" | ne ""}}'
    - bitrise-step-export-universal-apk@0:
        run_if: '{{getenv "BITRISEIO_ANDROID_KEYSTORE_URL" | ne ""}}'
    - generate-changelog@0: {}
    - github-release@0:
        run_if: '{{getenv "GITHUB_API_TOKEN" | ne ""}}'
        inputs:
        - api_token: "$GITHUB_API_TOKEN"
        - name: "$BITRISE_GIT_TAG"
        - body: "$BITRISE_CHANGELOG"
        - files_to_upload: |-
            $BITRISE_AAB_PATH|citra-$BITRISE_GIT_TAG.aab
            $BITRISE_APK_PATH|citra-$BITRISE_GIT_TAG.apk
        - username: "$BITRISEIO_GIT_REPOSITORY_OWNER"
    - deploy-to-bitrise-io@1.3:
        run_if: '{{getenv "BITRISEIO_ANDROID_KEYSTORE_URL" | ne ""}}'
    - cache-push@2: {}
    - deploy-to-bitrise-io@2: {}
  primary:
    steps:
    - activate-ssh-key@4: {}
    - git-clone@6: {}
    - cache-pull@2: {}
    - script@1:
        title: Deps
        inputs:
        - content: |-
            #!/bin/bash
            set -ex
            sdkmanager --install "cmake;3.18.1"
    - install-missing-android-tools@3:
        inputs:
        - gradlew_path: "$PROJECT_LOCATION/gradlew"
    - android-lint@0:
        inputs:
        - project_location: "$PROJECT_LOCATION"
        - module: "$MODULE"
        - variant: "$BUILD_VARIANT"
    - android-build@1:
        inputs:
        - variant: "$BUILD_VARIANT"
        - project_location: "$PROJECT_LOCATION"
        - build_type: apk
    - cache-push@2: {}
    - deploy-to-bitrise-io@2: {}
meta:
  bitrise.io:
    stack: linux-docker-android-20.04
app:
  envs:
  - opts:
      is_expand: false
    PROJECT_LOCATION: src/android
  - opts:
      is_expand: false
    MODULE: app
  - opts:
      is_expand: false
    BUILD_VARIANT: Release
  - opts:
      is_expand: false