2019-04-26 09:08:35 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-04-26 09:30:21 +00:00
|
|
|
# Use sudo less Ruby
|
2019-04-26 09:08:35 +00:00
|
|
|
export GEM_HOME=$HOME/.gem
|
|
|
|
export PATH=$GEM_HOME/bin:$PATH
|
|
|
|
|
2019-04-26 09:30:21 +00:00
|
|
|
|
2019-04-26 09:08:35 +00:00
|
|
|
if [ ! $# -eq 1 ]; then
|
|
|
|
echo "Usage: ./buildRelease.sh [tag or branch]"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -n "$APPLE_ID" ]; then
|
|
|
|
echo "You must set the APPLE_ID env var before calling this script"
|
|
|
|
echo 'export APPLE_ID="foo.bar@apple.com"'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
TAG=$1
|
|
|
|
BUILD_DIR="build"/$TAG
|
|
|
|
BUILD_NUMBER=$( date +%Y%m%d%H%M%S )
|
|
|
|
|
|
|
|
|
|
|
|
if [ -e $BUILD_DIR ]; then
|
|
|
|
echo "Error: Folder ${BUILD_DIR} already exists"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Fastlane update
|
|
|
|
gem install bundler
|
|
|
|
bundle install
|
|
|
|
bundle update
|
|
|
|
|
2019-04-26 09:30:21 +00:00
|
|
|
|
2019-04-26 09:08:35 +00:00
|
|
|
# Checkout the source to build
|
|
|
|
mkdir -p $BUILD_DIR
|
|
|
|
cd $BUILD_DIR
|
2020-08-05 12:10:26 +00:00
|
|
|
REPO_URL=$(git ls-remote --get-url origin)
|
|
|
|
REPO_NAME=$(basename -s .git $REPO_URL)
|
2020-09-03 13:17:10 +00:00
|
|
|
git clone $REPO_URL --depth=1 --branch $TAG
|
2020-08-05 12:10:26 +00:00
|
|
|
cd $REPO_NAME
|
2020-09-03 13:17:10 +00:00
|
|
|
|
2019-04-26 09:08:35 +00:00
|
|
|
|
2020-08-28 10:11:46 +00:00
|
|
|
# Use appropriated dependencies according to the current branch
|
|
|
|
bundle exec fastlane point_dependencies_to_same_feature
|
2019-04-26 09:08:35 +00:00
|
|
|
|
|
|
|
# Build
|
2020-09-08 15:39:51 +00:00
|
|
|
bundle exec fastlane app_store build_number:$BUILD_NUMBER git_tag:$TAG
|
2019-04-26 09:08:35 +00:00
|
|
|
|
|
|
|
if [ -e out/Riot.ipa ]; then
|
|
|
|
# Here is the artefact
|
|
|
|
cp out/Riot.ipa ../../../Riot-$TAG-$BUILD_NUMBER.ipa
|
|
|
|
|
|
|
|
echo "Riot-$TAG-$BUILD_NUMBER.ipa has been successfully built"
|
|
|
|
fi
|