Created
May 23, 2021 15:52
-
-
Save Pasi-D/57e48981c42923e41611e16d0bcbd5c6 to your computer and use it in GitHub Desktop.
App center pre build script to update your react native .env with versioning info
This file contains hidden or 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 | |
# Make a copy of .env.dist | |
echo "Updating version name in .env" | |
echo " - Version Name : $MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION-$PRE_RELEASE" | |
cd ${APPCENTER_SOURCE_DIRECTORY} | |
cp .env.dist .env | |
# Replace environment variables | |
sed -i '' "s/MAJOR_VERSION=.*/MAJOR_VERSION=$MAJOR_VERSION/" .env | |
sed -i '' "s/MINOR_VERSION=.*/MINOR_VERSION=$MINOR_VERSION/" .env | |
sed -i '' "s/PATCH_VERSION=.*/PATCH_VERSION=$PATCH_VERSION/" .env | |
sed -i '' "s/PRE_RELEASE=.*/PRE_RELEASE=$PRE_RELEASE/" .env | |
# Print out .env for reference | |
cat .env | |
echo "updated .env!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment