image: alpine/latest

packages:
- docker

sources:
- https://git.sr.ht/~thestr4ng3r/chiaki

artifacts:
- Chiaki.apk
- Chiaki.aab

secrets:
- 163950ff-2ac4-423d-a280-d2d9edbef000
- f4bce41f-f96b-4633-80d8-0ff5dd74dc2a

tasks:
- build: |
    cp -v ~/chiaki-local.properties chiaki/android/local.properties || echo "Secrets not available"
    sudo service docker start
    timeout 15 sh -c "until sudo docker info; do sleep 0.5; done"
    sudo docker run \
      -v /home/build:/home/build \
      -u $(id -u):$(id -g) \
      thestr4ng3r/android:90d826e \
      /bin/bash -c "cd /home/build/chiaki/android && ./gradlew assembleRelease bundleRelease"
    cp chiaki/android/app/build/outputs/apk/release/app-release*.apk Chiaki.apk
    cp chiaki/android/app/build/outputs/bundle/release/app-release*.aab Chiaki.aab
