Last active
January 5, 2018 09:46
-
-
Save MichaelBorde/59b4f7334794a6a639b4507792b1a2de to your computer and use it in GitHub Desktop.
React Native android release with scripts and fastlane
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ROOT="$(cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd)" | |
main() { | |
local mode="$1" | |
echo "building apk with mode ${mode}" | |
cd "${ROOT}" | |
build_android "${mode}" | |
print_usage "${mode}" | |
} | |
build_android() { | |
local mode="$1" | |
local gradleTask="assembleDebug" | |
if [[ "${mode}" == "release" ]]; then | |
gradleTask="assembleRelease" | |
fi | |
( cd android && ./gradlew "${gradleTask}" ) | |
} | |
print_usage() { | |
local mode="$1" | |
local output="${ROOT}/android/app/build/outputs/apk/app-${mode}.apk" | |
echo "You can: adb install -r ${output}" | |
} | |
( main "$@" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fastlane_version '2.64.1' | |
default_platform :android | |
platform :android do | |
desc 'Deploy a new version to the Google Play' | |
lane :alpha do | |
gradle(task: 'assembleRelease') | |
supply( | |
track: 'alpha' | |
) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"build:android:debug": "scripts/build-apk.sh debug", | |
"build:android:release": "scripts/build-apk.sh release", | |
"deploy:android:alpha": "cd android && bundle exec fastlane alpha" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment