68 lines
2.7 KiB
YAML
68 lines
2.7 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: Android
|
|
|
|
steps:
|
|
- name: prepare signing
|
|
image: busybox
|
|
environment:
|
|
STOREPASSWORD:
|
|
from_secret: StorePassword
|
|
KEYPASSWORD:
|
|
from_secret: KeyPassword
|
|
commands:
|
|
- touch keystore.properties
|
|
- echo "storePassword=$STOREPASSWORD" >> keystore.properties
|
|
- echo "keyPassword=$KEYPASSWORD" >> keystore.properties
|
|
- echo "keyAlias=key0" >> keystore.properties
|
|
- echo "storeFile=../AndroidKey" >> keystore.properties
|
|
|
|
- name: generate versionCode
|
|
image: busybox
|
|
commands:
|
|
- touch version.properties
|
|
- let timestamp=$(date +%s)/10
|
|
- echo "versionCode=$timestamp" >> version.properties
|
|
|
|
- name: deploy latest build
|
|
image: curlimages/curl
|
|
environment:
|
|
SEAFILE_API_KEY:
|
|
from_secret: SeafileApiKey
|
|
APK_FILE: app/build/outputs/apk/release/app-release.apk
|
|
BUNDLE_FILE: app/build/outputs/bundle/release/app-release.aab
|
|
SEAFILE_REPO: 6debeef9-121e-46ba-acc7-81e109fdcbdd
|
|
commands:
|
|
- 'UPLOAD_URL=$(curl -H "Authorization: Token $SEAFILE_API_KEY" https://seafile.zobrist.me/api2/repos/$SEAFILE_REPO/upload-link/ | tr -d "\"")'
|
|
- echo $UPLOAD_URL
|
|
- 'curl -H "Authorization: Token $SEAFILE_API_KEY" -F file=@$APK_FILE -F parent_dir=/ -F relative_path=latest/ -F replace=1 "$UPLOAD_URL"'
|
|
- 'curl -H "Authorization: Token $SEAFILE_API_KEY" -F file=@$BUNDLE_FILE -F parent_dir=/ -F relative_path=latest/ -F replace=1 "$UPLOAD_URL"'
|
|
|
|
- name: deploy tagged build
|
|
image: curlimages/curl
|
|
environment:
|
|
SEAFILE_API_KEY:
|
|
from_secret: SeafileApiKey
|
|
APK_FILE: app/build/outputs/apk/release/app-release.apk
|
|
BUNDLE_FILE: app/build/outputs/bundle/release/app-release.aab
|
|
SEAFILE_REPO: 6debeef9-121e-46ba-acc7-81e109fdcbdd
|
|
commands:
|
|
- 'UPLOAD_URL=$(curl -H "Authorization: Token $SEAFILE_API_KEY" https://seafile.zobrist.me/api2/repos/$SEAFILE_REPO/upload-link/ | tr -d "\"")'
|
|
- 'curl -H "Authorization: Token $SEAFILE_API_KEY" -F file=@$APK_FILE -F parent_dir=/ -F relative_path=tagged/$DRONE_TAG/ -F replace=1 "$UPLOAD_URL"'
|
|
- 'curl -H "Authorization: Token $SEAFILE_API_KEY" -F file=@$BUNDLE_FILE -F parent_dir=/ -F relative_path=tagged/$DRONE_TAG/ -F replace=1 "$UPLOAD_URL"'
|
|
- 'curl -d "operation=rename&newname=app-release$DRONE_TAG.apk" -H "Authorization: Token $SEAFILE_API_KEY" https://seafile.zobrist.me/api2/repos/$SEAFILE_REPO/file/?p=/tagged/$DRONE_TAG/app-release.apk'
|
|
- 'curl -d "operation=rename&newname=app-release$DRONE_TAG.aab" -H "Authorization: Token $SEAFILE_API_KEY" https://seafile.zobrist.me/api2/repos/$SEAFILE_REPO/file/?p=/tagged/$DRONE_TAG/app-release.aab'
|
|
when:
|
|
event:
|
|
- tag
|
|
|
|
- name: slack notification
|
|
image: plugins/slack
|
|
settings:
|
|
webhook:
|
|
from_secret: SlackWebhook
|
|
when:
|
|
status:
|
|
- failure
|
|
- success |