Last active
November 17, 2020 17:07
-
-
Save seanconrad1/6291ccb06165d11aa6377c34edec44d8 to your computer and use it in GitHub Desktop.
CI/CD for react-native expo
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 | |
#https://blog.expo.io/automating-standalone-expo-app-builds-and-deployments-with-fastlane-exp-and-exptool-9b2f5ad0a2cd | |
set -e # exit entire script when command exits with non-zero status | |
read_var() { | |
VAR=$(grep $1 $2 | xargs) | |
IFS="=" read -ra VAR <<< "$VAR" | |
echo ${VAR[1]} | |
} | |
npm install | |
export DELIVER_USERNAME=$(read_var DELIVER_USERNAME .env) | |
export FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=$(read_var FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD .env) | |
export DELIVER_PASSWORD=$(read_var DELIVER_PASSWORD .env) | |
node ./updateBuildNumber.js | |
expo publish --release-channel production --non-interactive | |
# ANDROID | |
# Start building standalone android build using `production` release channel | |
# expo build:android -t --non-interactive apk | |
expo build:android --release-channel production --non-interactive --no-publish | |
curl -o app.apk "$(expo url:apk --non-interactive)" | |
#fastlane supply --track 'production' --json_key '<path/to/json_key.json>' --package_name "<your-package-name>" --apk "app.apk" --skip_upload_metadata --skip_upload_images --skip_upload_screenshots | |
#ANDROID END | |
#IOS | |
expo build:ios --release-channel production --non-interactive --no-publish | |
curl -o app.ipa "$(expo url:ipa --non-interactive)" | |
fastlane deliver --verbose --ipa "app.ipa" --skip_screenshots --skip_metadata --team_id | |
#IOS END | |
# fastlane fastlane-credentials add --username eu@alexfiloti.com |
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
const fs = require('fs'); | |
let updateAppJSON = {}; | |
const data = fs.readFileSync('./app.json', 'utf8'); | |
const result = JSON.parse(data); | |
const IOSbuildNumber = parseFloat(result.expo.ios.buildNumber); | |
const AndroidbuildNumber = result.expo.android.versionCode; | |
result.expo.ios.buildNumber = (IOSbuildNumber + 0.1).toFixed(1).toString(); | |
result.expo.android.versionCode = AndroidbuildNumber + 1; | |
updateAppJSON = result; | |
try { | |
fs.writeFileSync('./app.json', JSON.stringify(updateAppJSON)); | |
console.log('done!'); | |
//file written successfully | |
} catch (err) { | |
console.error(err); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment