Skip to content

Instantly share code, notes, and snippets.

@mglagola
Created February 22, 2018 17:36
Show Gist options
  • Save mglagola/fcf1fc14d333b41520db87a3a2d02c88 to your computer and use it in GitHub Desktop.
Save mglagola/fcf1fc14d333b41520db87a3a2d02c88 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
#### 2. Script Setup ####
# Exptool will exit with non-zero statuses when a certain command fails.
# It's useful to exit the bash script when a command exits with a non-zero status
# as the following commands must be run successfully in sequence for expected results.
set -e # exit entire script when command exits with non-zero status
# Install dependencies
npm install
# [Optional] Login to Expo using username & password
# You may or may not need to do this depending on your setup.
# Note the $EXPO_USERNAME and $EXPO_PASSWORD env variables
# exp login -u $EXPO_USERNAME -p $EXPO_PASSWORD --non-interactive
#### 3. Publish to Expo ####
# Publish `production` release
exp publish --release-channel production --non-interactive
#### 4. Building Android Standalone App ####
# Makes sure that there are no standalone app builds in progress.
# Will exit with a non-zero status code if there is an active standalone app build already in progress.
exptool check:status
# Start building standalone android build using `production` release channel
exp build:android --release-channel production --non-interactive
# Wait for the build to finish, checking its status every 2 mins (timeout is 20 mins)
# Will exit 0 (success) once the build has successfully been built
# Android builds take a little longer in my experience, hence the longer interval and timeout.
exptool wait:build --interval 120 --timeout 1200
# Download the artifact to current directory as `app.apk`
exptool download:artifact
#### 5. Submit and publish standalone Android app to the Google Play Store ####
# Use fastlane to upload your current standalone android build
# Customize this to fit your needs. Take note of env variables.
# Check out https://docs.fastlane.tools for more info.
fastlane supply --track 'production' --json_key '<path/to/json_key.json>' --package_name "$(exptool android:package)" --apk "app.apk" --skip_upload_metadata --skip_upload_images --skip_upload_screenshots
#### 6. Building iOS Standalone App ####
# Makes sure that there are no standalone app builds in progress.
# Will exit with a non-zero status code if there is an active standalone app build already in progress.
exptool check:status
# Start building standalone android build using `production` release channel
exp build:ios --release-channel production --non-interactive
# Wait for the build to finish, checking its status periodically
# Will exit 0 (success) once the build has successfully been built
exptool wait:build # using default interval & timeout
# Download the artifact to current directory as `app.ipa`
exptool download:artifact
#### 7. Submit standalone iOS app to iTunes Connect ####
# Make sure the following env variables are set
# export DELIVER_USERNAME=<your-itunes-connect-email>
# export DELIVER_PASSWORD=<your-itunes-connect-password>
# Use fastlane to upload your current standalone iOS build to itc
fastlane deliver --verbose --ipa "app.ipa" --skip_screenshots --skip_metadata
#### Misc ####
# [Optional] You may or may not need to do this depending on your setup.
# exp logout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment