image: archlinux
shell: false
packages:
  - jdk11-openjdk
  - android-sdk-cmdline-tools-latest
  - openssl
  - git
  - curl
sources:
  - https://git.sr.ht/~captainepoch/husky
artifacts:
  - ~/sign/husky_latest_stable.apk
environment:
  ANDROID_SDK_ROOT: "/opt/android-sdk"
  BUILD_TOOLS: "build-tools;31.0.0"
  BUILD_PLATFORMS: "platforms;android-30"
  JAVA_HOME: "/usr/lib/jvm/default"
  PROJECT: husky/husky
secrets: []
triggers:
  - action: email
    condition: always
    to: ~captainepoch/ci@lists.sr.ht
tasks:
  - setup-sdk: |
      source /etc/profile
      sudo chown $USER:$USER -R ${ANDROID_HOME}
      yes | sdkmanager --sdk_root=$ANDROID_HOME --licenses
      yes | sdkmanager --sdk_root=$ANDROID_HOME --update
      yes | sdkmanager --sdk_root=$ANDROID_HOME "${BUILD_TOOLS}" "${BUILD_PLATFORMS}"
  - build-husky: |
      cd ${PROJECT}
      chmod +x gradlew
      ./gradlew assembleHuskyStableRelease --rerun-tasks
  - upload-artifact: |
      mkdir -p ~/sign
      HUSKY_APK=$(find ${HOME} -type f -name "*husky*.apk*")
      echo $HUSKY_APK
      mv $HUSKY_APK ~/sign/husky_latest_stable.apk
