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 fb873c4
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 68 deletions.
17 changes: 15 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,25 @@ 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

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.

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

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

bundle exec fastlane buildAAB

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
35 changes: 35 additions & 0 deletions scripts/upload-master-apk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

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

bundle exec fastlane buildAAB

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 fb873c4

Please sign in to comment.