---
kind: pipeline
type: docker
name: Android

steps:
- name: build
  image: mingc/android-build-box
  environment:
    STOREPASSWORD:
      from_secret: StorePassword
    KEYPASSWORD:
      from_secret: KeyPassword
  volumes:
  - name: deploy
    path: /tmp/deploy
  commands:
  - touch keystore.properties
  - storePassword=$STOREPASSWORD >> keystore.properties
  - keyPassword=$KEYPASSWORD >> keystore.properties
  - keyAlias=key0 >> keystore.properties
  - storeFile=../AndroidKey >> keystore.properties
  - ./gradlew test
  - ./gradlew assembleDebug
  - ./gradlew bundleRelease
  - mkdir /tmp/deploy/lastBuild
  - cp ./app/build/outputs/apk/debug/app-debug.apk /tmp/deploy/lastBuild/app-debug.apk
  - cp ./app/build/outputs/bundle/release/app-release.aab /tmp/deploy/lastBuild/app-release.aab 

volumes:
  - name: deploy
    host:
      path: /mnt/seafile-sync-cli/TichuCounter