Add support for automatic prebuilt repo deployments

This commit is contained in:
Steve Soltys 2019-09-21 16:36:29 -04:00
parent 7a7059cda3
commit 710fcb439c
4 changed files with 34 additions and 30 deletions

View file

@ -20,7 +20,7 @@ before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
script: ./gradlew check
script: ./gradlew check assemble
cache:
directories:
@ -29,14 +29,10 @@ cache:
- $HOME/.android/build-cache
deploy:
provider: releases
api_key:
secure: BJ+0riccbDPQMcvZkYveHHcSa3wlVRdvLIHMJtZQXmjJnYu4Mh2YH4RkZdd+4OBPf2iBCyP1CIxB9NTKldb8Qn1m/6+LcReYf2xd8Y6XCrHDsycT5GZTENEif0EyVPdB1En4NwRVYiNwGMSv49Cz03aGtzq5jrGWxPhYAEY4jt86HKRqw8SCUPEqug3Rz+deG4juUdIAvARiN8jKoqu9EeMOP5ST7nbZjZQbee8SGP7wPW+J7E6kWPvn+mSoZsMXw/ELz8nEAu4pHh/98agreMvApjImpiEpVXNhMpENfk42U+wztiGNspoOh/vDFrNikWFGIJ3lE4yPJteBo2vpVo/7/tfBzKjMnL7c/5ZNMnjv9e2yoqwfpwmh8GzjKaDuwG1Fy8g5ctJAS4wYHr4z4LDlfdmFVUE3r3NPI8XdzsnjVpqkXhC/5eBPO50p82c0Za24SwkmO+JzIaIF41fTt0An9Dd/1Q5321WGJK6HqQwdjRG3HciLF6lNJu/gzSVHnfC9REQGY7vDdNSVaP9ps0W07URewsKwC5Vm5SFYUEFIM2d3C+62+eciqlpfqON6htd9zAZnFTSE6rMTJdGXMs+hLb89C1J3tavz89T2d9Dqnvs6MlKEO3ontDcwYdbx8czPKv22Fm4iI4XG6VTzK9hS4BNCvhvyvqSq7mYIXsA=
file:
- app/build/outputs/apk/release/app-release-unsigned.apk
- app/src/main/permissions_com.stevesoltys.backup.xml
- app/src/main/whitelist_com.stevesoltys.backup.xml
provider: script
script: ./deploy-prebuilt.sh
skip_cleanup: true
on:
repo: stevesoltys/backup
tags: true
skip_cleanup: true
all_branches: true
condition: $TRAVIS_BRANCH =~ ^(master|develop)$

View file

@ -25,12 +25,6 @@ LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
backup_root := $(LOCAL_PATH)
$(backup_root)/Backup.apk:
cd $(backup_root) && ./download.sh
LOCAL_MODULE := Backup
LOCAL_SRC_FILES := Backup.apk
LOCAL_CERTIFICATE := platform

28
deploy-prebuilt.sh Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
#
# Script to deploy to a prebuilt repo.
REPO_URL="https://stevesoltys:$GITHUB_API_KEY@github.com/stevesoltys/backup-prebuilt"
TAG=$(git tag -l --points-at HEAD)
git config --global user.email "github@stevesoltys.com"
git config --global user.name "Steve Soltys"
git clone --quiet $REPO_URL
cd backup-prebuilt
git checkout $TRAVIS_BRANCH || git checkout -b $TRAVIS_BRANCH
rm -Rf ./*
cp $TRAVIS_BUILD_DIR/Android.mk .
cp $TRAVIS_BUILD_DIR/app/build/outputs/apk/release/app-release-unsigned.apk ./Backup.apk
cp $TRAVIS_BUILD_DIR/permissions_com.stevesoltys.backup.xml .
cp $TRAVIS_BUILD_DIR/whitelist_com.stevesoltys.backup.xml .
cp $TRAVIS_BUILD_DIR/default-permissions_com.stevesoltys.backup.xml .
git add .
git commit -m "Travis build $TRAVIS_BUILD_NUMBER"
git push origin $TRAVIS_BRANCH
if [ ! -z ${TAG} ]; then
git tag ${TAG}
git push origin --tags
fi

View file

@ -1,14 +0,0 @@
#!/bin/bash
#
# Script to download apk from github releases
BASE_URL="https://github.com/stevesoltys/backup/releases"
APK="app-release-unsigned.apk"
VERSION="latest/download"
TAG=$(git tag -l --points-at HEAD)
if [ ! -z ${TAG} ]; then
VERSION="download/${TAG}"
fi
curl -L ${BASE_URL}/${VERSION}/${APK} > Backup.apk