From 7296135b562bb11d741c85e441e075c1d95a470a Mon Sep 17 00:00:00 2001 From: Norwin Roosen Date: Fri, 29 Mar 2019 18:03:57 +0100 Subject: [PATCH] add travis deploy task for fdroid #5 pushes build result of platforms/android to `fdroid` branch, so fdroid can build using a standard gradle project. TODO: re-enable `on: tags` build option after testing --- .travis.yml | 30 ++++++++++++++++++------------ tools/deploy-fdroid.sh | 15 +++++++++++++++ 2 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 tools/deploy-fdroid.sh diff --git a/.travis.yml b/.travis.yml index 57af0c4..8587bbf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,28 @@ -language: node_js +language: android node_js: - "8" -branches: - only: - - master - before_script: - npm install +- npm install -g ionic cordova script: - npm run build +- npm run android:build deploy: - provider: pages - skip-cleanup: true - github-token: $GITHUB_TOKEN - keep-history: true - on: - tags: true - local_dir: www + # deploy web build to gh-pages branch + - provider: pages + skip-cleanup: true + github-token: $GITHUB_TOKEN + keep-history: true + #on: + # tags: true + local_dir: www + + # deploy android project for fdroid builds + - provider: script + script: bash tools/deploy-fdroid.sh + skip-cleanup: true + #on: + # tags: true diff --git a/tools/deploy-fdroid.sh b/tools/deploy-fdroid.sh new file mode 100644 index 0000000..300015b --- /dev/null +++ b/tools/deploy-fdroid.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# expects travis env vars: $repo, $tag, $rev, $GITHUB_TOKEN + +target=https://$GITHUB_TOKEN@github.com/sensebox/blockly-app.git +branch=fdroid + +git clone --depth=1 -b $target $repo fdroid +rm -rf fdroid/* +mv -f platforms/android fdroid/ +cd fdroid +git config user.name "Travis-CI" +git config user.email "travis@travis-ci.org" +git add -f --ignore-errors . +git commit -m "android project for $tag at $rev" --amend # dont add new commits to avoid increasing repo size +git push -f $target $branch > /dev/null 2>&1 # hide output to not leak GITHUB_TOKEN in logs