Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
create build script
Browse files Browse the repository at this point in the history
  • Loading branch information
jabedzaman committed Feb 11, 2023
1 parent fb59ee6 commit 39dd5eb
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ web-build/
.env.development.local
.env.test.local
.env.production.local

# config files
/config/apikey.config.js
19 changes: 0 additions & 19 deletions eas.json

This file was deleted.

77 changes: 77 additions & 0 deletions scripts/build.sh
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

0 comments on commit 39dd5eb

Please sign in to comment.