Skip to content

Commit

Permalink
chore: improved build scripts with deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
adityastic committed Aug 4, 2019
1 parent d28ca2e commit 6c4f374
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 68 deletions.
18 changes: 16 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,26 @@ cache:
- "${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/"
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"

install:
- bundle install

before_script:
- bash scripts/prep-key.sh

script:
- ./gradlew spotlessCheck
- ./gradlew build --stacktrace
after_success:
- bash scripts/upload-apk.sh
- bundle exec fastlane buildAAB

deploy:
- provider: script
skip_cleanup: true
script: bash scripts/upload-development-apk.sh
on:
branch: development
- provider: script
skip_cleanup: true
script: bash scripts/upload-master-apk.sh
on:
branch: master
66 changes: 0 additions & 66 deletions scripts/upload-apk.sh

This file was deleted.

29 changes: 29 additions & 0 deletions scripts/upload-development-apk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

git config --global user.name "Travis CI"
git config --global user.email "[email protected]"

git clone --quiet --branch=apk https://fossasia:$GITHUB_KEY@github.com/fossasia/badge-magic-android apk > /dev/null
cd apk

rm -rf badge-magic-dev-*

find ../app/build/outputs -type f \( -name '*.apk' -o -name '*.aab' \) -exec cp -v {} . \;

for file in app*; do
if [[ ${file} =~ ".aab" ]]; then
mv ${file} badge-magic-dev-${file}
else
mv ${file} badge-magic-dev-${file:4}
fi
done

git checkout --orphan temporary

git add --all .
git commit -am "[Auto] Update Test Apk ($(date +%Y-%m-%d.%H:%M:%S))"

git branch -D apk
git branch -m apk

git push origin apk --force --quiet > /dev/null
33 changes: 33 additions & 0 deletions scripts/upload-master-apk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

git config --global user.name "Travis CI"
git config --global user.email "[email protected]"

git clone --quiet --branch=apk https://fossasia:$GITHUB_KEY@github.com/fossasia/badge-magic-android apk > /dev/null
cd apk

rm -rf *

find ../app/build/outputs -type f \( -name '*.apk' -o -name '*.aab' \) -exec cp -v {} . \;

for file in app*; do
if [[ ${file} =~ ".aab" ]]; then
mv ${file} badge-magic-master-${file}
else
mv ${file} badge-magic-master-${file:4}
fi
done

git checkout --orphan temporary

git add --all .
git commit -am "[Auto] Update Test Apk ($(date +%Y-%m-%d.%H:%M:%S))"

git branch -D apk
git branch -m apk

git push origin apk --force --quiet > /dev/null

cd ..

bundle exec fastlane uploadToPlaystore

0 comments on commit 6c4f374

Please sign in to comment.