This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb59ee6
commit 39dd5eb
Showing
3 changed files
with
79 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,6 @@ web-build/ | |
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
# config files | ||
/config/apikey.config.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/bash | ||
|
||
# check if version is same in package.json and app.config.js | ||
|
||
cd .. | ||
packageversion=$( cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') | ||
cd config | ||
configversion=$( cat app.config.js| grep version | head -1 | awk -F\" '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]') | ||
cd .. | ||
if [ "$packageversion" != "$configversion" ]; then | ||
echo "version mismatch" | ||
echo "package.json version: $packageversion" | ||
echo "app.config.js version: $configversion" | ||
echo "please update app.config.js version" | ||
exit 0 | ||
fi | ||
|
||
# check if version is satisfied | ||
|
||
echo "Are you sure you want to build version $packageversion (n/Y)?" | ||
read build | ||
if [ "$build" == "n" ] || [ "$build" == "N" ] || [ "$build" == "no" ] || [ "$build" == "No" ] || [ "$build" == "NO" ]; then | ||
echo "build cancelled" | ||
exit 0 | ||
fi | ||
|
||
# check if api is setup or not | ||
|
||
cd config | ||
if [ ! -f "apikey.config.js" ]; then | ||
echo "api.config.js is not found" | ||
echo "please setup api.config.js" | ||
exit 0 | ||
fi | ||
cd .. | ||
|
||
# remove api key from .gitignore | ||
echo "removing apikey.config.js from .gitignore" | ||
sleep 1 | ||
sed -i '/apikey.config.js/d' .gitignore | ||
|
||
|
||
# create build script | ||
|
||
echo "creating build script" | ||
echo "{" >> eas.json | ||
echo " \"build\": {" >> eas.json | ||
echo " \"preview\": {" >> eas.json | ||
echo " \"android\": {" >> eas.json | ||
echo " \"buildType\": \"apk\"" >> eas.json | ||
echo " }" >> eas.json | ||
echo " }," >> eas.json | ||
echo " \"preview2\": {" >> eas.json | ||
echo " \"android\": {" >> eas.json | ||
echo " \"gradleCommand\": \":app:assembleRelease\"" >> eas.json | ||
echo " }" >> eas.json | ||
echo " }," >> eas.json | ||
echo " \"preview3\": {" >> eas.json | ||
echo " \"developmentClient\": true" >> eas.json | ||
echo " }," >> eas.json | ||
echo " \"production\": {}" >> eas.json | ||
echo " }" >> eas.json | ||
echo "}" >> eas.json | ||
echo "Build script created" | ||
|
||
# start building | ||
|
||
echo "starting build" | ||
sleep 3 | ||
clear | ||
eas build -p android --profile preview | ||
|
||
|
||
# add api key again to .gitignore | ||
|
||
echo "/config/apikey.config.js" >> .gitignore | ||
rm eas.json |