MediumHow to automate the ionic build [Updated 2024] | by Deepak Ranjan | Medium
Sitemap
Deepak Ranjan

Deepak Ranjan

I have strong background in both front-end and back-end development such as JavaScript, Angular, Node.js, Express, and ElasticSearch.

Member-only story

How to automate the ionic build [Updated 2024]

2 min readSep 7, 2021

--

Hello everyone, This is my first blog on medium. Today I am going to show you “How can automate the build process in Ionic“.

I was working on a project and for build apk file, every time I ran this command manually:-

#Generating a key (if you have key then skip this step)

keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias

#Signing

apksigner sign — ks key.jks — v1-signing-enabled true — v2-signing-enabled true app-release-unsigned.apk

#Compress

zipalign -v 4 app-release-unsigned.apk HelloWorld.apk

#Verify

apksigner verify HelloWorld.apk

I think this is a very tedious job. So, I decided to write an automated process with the help of Shell Scripting. Please follow these steps:-

Step 1. Make a file with an extension of sh in the root directory. Example- build.sh

Step 2. Copy the below code.

#!/bin/bashCONFIG_FILE="config.xml"APP_NAME=$(awk -F '[<>]' '/<name>/ {print $3}' "$CONFIG_FILE" | head -n 1)
echo -e "App Name: $APP_NAME"
#Remove spaces and convert to lowercase
APP_NAME_NO_SPACES_LOWER=$(echo "${APP_NAME// /}" | tr '[:upper:]' '[:lower:]')
echo -e "APP_NAME_NO_SPACES…

--

--

Deepak Ranjan
Deepak Ranjan

Written by Deepak Ranjan

I have strong background in both front-end and back-end development such as JavaScript, Angular, Node.js, Express, and ElasticSearch.