<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dong Mai on Medium]]></title>
        <description><![CDATA[Stories by Dong Mai on Medium]]></description>
        <link>https://medium.com/@doongmai?source=rss-711e056e804e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3TakMfX7fneLXk-ctparKQ.png</url>
            <title>Stories by Dong Mai on Medium</title>
            <link>https://medium.com/@doongmai?source=rss-711e056e804e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 12:13:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@doongmai/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How we customize and deliver our mobile app templates with fastlane & Jenkins]]></title>
            <link>https://medium.com/altitudehq/how-we-customize-and-deliver-our-mobile-app-templates-with-fastlane-jenkins-5c88f3a82633?source=rss-711e056e804e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c88f3a82633</guid>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[mobile-devops]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[fastlane]]></category>
            <dc:creator><![CDATA[Dong Mai]]></dc:creator>
            <pubDate>Wed, 02 Feb 2022 06:09:17 GMT</pubDate>
            <atom:updated>2022-02-02T07:09:16.286Z</atom:updated>
            <content:encoded><![CDATA[<h3>How we customise and deliver on-demand our native mobile app templates automatically with Fastlane and Jenkins</h3><h3>Introduction</h3><p>In this article I want to share how we implement a solution that helps us customize on demand our native Altitude Guest app templates (<a href="https://www.altitudehq.com/guest/smart-guest-phone-app/">A smart hotel in your guests’ pocket</a>) without writing a line of code, and then deliver it to customers.</p><p>Some of you may have heard about “Print on demand”, it’s where you can go to custom a T-Shirt, a Mug, or a Blanket, you can upload your images here, change some text … once its done you can buy it through the checkout process. And after some days the item will be delivered to you looking exactly as same as your customization.</p><p>We want the same for our app templates. Imagine there is a webpage where you can customize an app, including the icon, styles, text color, turn on/off features, or change the app’s language. Then when you’re happy, with a click of a button, it will start building your app and notify you via email that it is ready to install on your devices.</p><h3>What problem does this solve?</h3><p>Below are three versions of the Altitude Guest app, it is a white label app that we can adjust configurations and styles and deliver different apps depending on customer needs from single source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*SBHHeONzoDc8Wpr5sILNkA.jpeg" /><figcaption>Example apps with different colors, styles and icons</figcaption></figure><h4>The current process</h4><p>First we made our apps code-base support templates and each time a new customer on-boards our customer success team and developers have to complete the manual tasks as below:</p><ul><li>Setup a new target for the customer and clone template files from existing targets</li><li>Update app configuration file (a JSON file that configures functionalities in the app, for example customer A might need feature X but customer B does not need it)</li><li>Update localization (we support multiple translations, plus allows a customer to set their preferred marketing languages, e.g. Stay vs Reservation. As well as cross industries: Student Accommodation vs Hotels)</li><li>Update images (for example; splash screen, logos, app icon, etc.)</li><li>Update app styles (a JSON file that styles the app — all elements style in app features, including button colors, header/text colors, shadows, corner radius and more)</li><li>Additional configuration and third party setup (like social logins, OS specific setup, push notifications and more)</li><li>Test app</li><li>Deliver apps to customers (for beta testing and store release)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*hjWkLtXgzzhdp8ijLfqVcA.jpeg" /><figcaption>The problem: Many manual tasks</figcaption></figure><h3>The solution</h3><p>Automation is the key to time and cost saving. Our web services already implement many levels of continuous deployment — why should our apps not.</p><p>Building automation tools saves time on setting up new customers but will also allow us to give potential and new customers a web page to configure their apps and click “Build My App” and all steps above are done automatically. As well as allow us and customers to update apps very simply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*HD5zggWe0EOUl45t8Vacsg.jpeg" /><figcaption>Expected result after applying the solution</figcaption></figure><h4>Main Components</h4><p><strong><em>1. The Web UI<br></em></strong>The font-end part that will works directly with customers to collect their requirement, it will have one service as its backend.</p><p>Here customers will customize the app as they need, we will list out what can be customized like app template (set of colors, style), localization&#39;s for display items, and more. The interface will also later include a web render of what their app will look like.</p><p><strong><em>2. The App Generation Service<br></em></strong>When users manipulate their apps on web UI we need a service to store the data for later use in the build process, plus it will have to communicate with the build machine for builds and keep track on build status/history (here we used Typescript for development).</p><p>The service is a series of CURD APIs and additional calls to 3rd party services (e.g. Firebase, Apple, Graph Facebook APIs, Google, etc.).</p><p><strong><em>3. Build machine with CI/CD tool</em><br></strong>The service itself cannot build and deliver apps (e.g. Apple OS can only build iPhone apps) so we need a build machine, here we use a Mac Mini (M1) that has an internet connection (can consider it as a Mac server) and it has Jenkins installed.</p><p>The Mac is set up in a way so the App Generation Service is able to communicate with Jenkins (securely) to tell it to do tasks as creating a job or triggering a build etc. Fortunately, Jenkins provides a <a href="https://www.jenkins.io/doc/book/using/remote-access-api/">Remote Access API</a> as well, as well as a <a href="https://www.npmjs.com/package/jenkins-api">NodeJS API wrapper</a> since we are writing the service in TypeScript.</p><p><strong><em>4. A tool that helps to do manually tasks automatically<br></em></strong>As mentioned above our developers have to complete manual tasks when we have a new customer; here we have <strong><em>fastlane</em></strong> come to the rescue: “<em>fastlane</em> is an open source platform aimed at simplifying Android and iOS deployment. <em>fastlane</em> lets you automate every aspect of your development and release workflow”, see: <a href="https://fastlane.tools/">https://fastlane.tools</a>.</p><p>With fastlane we can write custom functions in its script (Fastfile) to help to do all those tasks that developers have to do manually before building progress starts.</p><h4>Automation tasks we need to deal with</h4><p><strong><em>1. Auto configure app on Firebase console on the service<br></em></strong>In the app we provide Google login functionality, Firebase crashlytics and Firebase push notifications. So we have to manually configure for it on Firebase console every time we build new app for a new customer.</p><p>To automate this we use <a href="https://firebase.google.com/docs/projects/api/reference/rest">Firebase Management API</a>. We integrate the API with help of <a href="https://www.npmjs.com/package/firebase-admin">firebase-admin</a> library, for detail on how setting it up please take a look at <a href="https://firebase.google.com/docs/admin/setup">https://firebase.google.com/docs/admin/setup</a>.</p><p>Bellow are those APIs that I used:</p><ul><li>Create iOS app: <a href="https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.iosApps/get">projects.iosApps.create</a></li><li>Create Android App: <a href="https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.androidApps/create">projects.androidApps.create</a></li><li>Get operation detail: <a href="https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/operations/get">operations.get</a> when creating app (iOS/Android) it will return an operation name - you will use this name for the API. The API returns content of config file in base64 that when decoding will be the GoogleService-Info.plist if app is iOS and Google-Services.json if app is Android. You need to save those Base64 in database to update it in projects via fastlane script</li></ul><p>Note, you still manually need to create a Firebase project on Firebase console and make an account service key and give it to the service so it can be able to authenticate with Firebase Management API and do things for you.</p><p><strong><em>2. Auto configure Facebook logins on the service<br></em></strong>Our app also provides Facebook login and if you’re mobile developers you should be familiar with it that any time you setup for new app you have to go <a href="http://developers.facebook.com/">Facebook Developer</a> site to create a new one and configure it.</p><p>But there is an other way to do it via <a href="https://developers.facebook.com/docs/graph-api/">Graph API</a> provided by Facebook, below are those ones that I used:</p><ul><li><a href="https://developers.facebook.com/docs/graph-api/reference/application/#Updating">Update application API</a>: with this api you can add iOS app’s bundle id or android app’s package name to existing Facebook app</li><li><a href="https://developers.facebook.com/docs/facebook-login/access-tokens/#apptokens">Create app access token</a>: create access token per app to be able to call the update API</li></ul><p>We can’t create new applications via the API so we create a set of Facebook applications before hand, then use those ones to configure for new app that customer requests — because once we have Facebook app we can give the service it’s appID and secret that are two parameters need for generating app access token.</p><p><strong><em>3. Manage Jenkins job and build via API<br></em></strong>The service will communicate with Jenkins via its provided APIs to create jobs and trigger builds, we’ll create a job per customer app.</p><p>To make it easy we have created template jobs here with necessary setup including git repository, execute scripts, placeholder environment variables that we can easily replace when creating the job from service side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*P9Pgrrc4-JTfdGo8KgHNuw.png" /><figcaption>Job templates</figcaption></figure><p>Here I use <em>copy_job</em> function from the <a href="https://www.npmjs.com/package/jenkins-api">jenkins-api</a> library, but first you will need an <a href="https://www.jenkins.io/doc/book/system-administration/authenticating-scripted-clients/">API token</a> to call the api.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47494b01c793bf4f94616b3e41d4aa63/href">https://medium.com/media/47494b01c793bf4f94616b3e41d4aa63/href</a></iframe><p>While building is in progress we also need to keep track of build status so from the service we provide an API (<em>PUT /jenkins-job/jobId/updateLatestBuild</em>) and <em>fastlane</em> can consume it to update latest build status — there are build statuses we’re using: scheduled, running, finished, cancelled and paused.</p><p><strong><em>4. Fastlane helps do manual tasks<br></em></strong>Fastlane script — fastfile — is ruby so we can do with a custom ruby function. Additionally, fastlane also provides a list of ready-to-use <a href="https://docs.fastlane.tools/plugins/available-plugins/">plugins</a> and <a href="https://docs.fastlane.tools/actions/">actions</a> you can pick the ones suite your needs.</p><p>As mentioned above currently we have to setup a new target on iOS project or flavor in Android project for any new customers and clone template files from existing targets/flavors (of old customers) then update those files to match new requirements. To make it easy for fastlane we have made a <em>placeholder target/flavor</em> that have already have any template files it needs, and fastlane’s tasks are just updating files and configuring project no need to create any new files.</p><p><strong><em>4.1. Pull template data via API</em></strong><em><br></em>Firstly fastlane need to pull the template data for the app via the service, I wrote a custom function to get it and class using here is <a href="https://ruby-doc.org/stdlib-3.1.0/libdoc/net/http/rdoc/Net/HTTP.html">NET::HTTP</a>. Its quite simple like you do api calls in other client languages as Swift, Java … .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d0e03fc2f4f421367d521111bd32514/href">https://medium.com/media/5d0e03fc2f4f421367d521111bd32514/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84f29b362cb04ab68a923fbe396fbeb8/href">https://medium.com/media/84f29b362cb04ab68a923fbe396fbeb8/href</a></iframe><p><strong><em>4.2. Change app name and bundle ID/package name<br></em></strong>For <strong><em>iOS </em></strong>we use <a href="https://docs.fastlane.tools/actions/update_info_plist/">update_info_plist</a> action</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d572959a36bf263a5bb7551c419de692/href">https://medium.com/media/d572959a36bf263a5bb7551c419de692/href</a></iframe><p>For <strong><em>Android </em></strong>we use <a href="https://github.com/MaximusMcCann/fastlane-plugin-android_change_string_app_name">android_change_string_app_name</a> plugin to change app name, and for package name I’ve to write a custom function to parse <strong><em>build.gradle</em></strong> file and update <strong><em>applicationId</em></strong> field</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a6a9d5d40443e5ab9569a1c181c6c1d/href">https://medium.com/media/7a6a9d5d40443e5ab9569a1c181c6c1d/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/43c5675763caa800957bbeb71dbe9a20/href">https://medium.com/media/43c5675763caa800957bbeb71dbe9a20/href</a></iframe><p><strong><em>4.3. change app icon<br></em></strong>All images the server will return as urls so we need a way to download them first before handling — here we use <a href="https://github.com/janko/down">down</a> tool for it. To be able to use it you need add gem &quot;down&quot; in the <strong><em>Gemfile</em></strong></p><p>for <strong><em>iOS</em></strong> we use <a href="https://github.com/fastlane-community/fastlane-plugin-appicon">appicon</a> plugin:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ff03aea2b4607a9f3f2c749fa0d9a99c/href">https://medium.com/media/ff03aea2b4607a9f3f2c749fa0d9a99c/href</a></iframe><p>for <strong><em>Android</em></strong> we use <a href="https://github.com/fastlane-community/fastlane-plugin-appicon">android_appicon</a> plugin:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3509a19af01aa945a3d9d9c45167e58/href">https://medium.com/media/f3509a19af01aa945a3d9d9c45167e58/href</a></iframe><p><strong><em>4.4. Change app images<br></em></strong>Change other images is quite simple as it’s just replacing file, I wrote a function for it so can replace one by one with ease:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13c94b1f2b99c951852f43bf07549482/href">https://medium.com/media/13c94b1f2b99c951852f43bf07549482/href</a></iframe><p><strong><em>4.5. change app localizations and other files by replacing<br></em></strong>The service will return localization files in platform-specific format so again it’s just a simple replacing files</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/63934a1fe066d6a191c8dd5884ab3831/href">https://medium.com/media/63934a1fe066d6a191c8dd5884ab3831/href</a></iframe><p>and for other files like app configuration (json), GoogleService-info.plist, Google-Service.json we just need to replace it with contents returned by server</p><p><strong><em>4.6. Configure Facebook/Google logins<br></em></strong>For <strong><em>iOS</em></strong> we have to update plist file to add FacebookAppID and URL Schemes to make Facebook/Google logins working like bellow screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*kolWk221x-bRwl64QW0mrg.png" /></figure><p>so I’ve to write custom functions to modify the plist file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/71c099e16c0a7c01c67df1cd5a15ab90/href">https://medium.com/media/71c099e16c0a7c01c67df1cd5a15ab90/href</a></iframe><p>For <strong><em>Android</em></strong> I need to update <strong><em>config_string.xml</em></strong> file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6ce931306ef49cabb457e42f48bea73/href">https://medium.com/media/e6ce931306ef49cabb457e42f48bea73/href</a></iframe><p>Finally, we’ve done all manually tasks with help of fastlane scripts, now let’s move on delivering apps…</p><p><strong><em>5. Deliver app<br></em></strong>For <strong>iOS</strong> side we use TF to deliver the app, but due to App Store limitation we couldn’t setup new apps 100% automatically via <a href="https://developer.apple.com/documentation/appstoreconnectapi">App Store Connect API</a>, as to setup new app ready for TF we need two steps:<br>- Setup new app identifier on <a href="https://developer.apple.com/">Apple developer site</a> (1)<br>- Setup the new app on <a href="https://appstoreconnect.apple.com/">App store connect</a> (2)</p><p>with App store connect API we can just do (1) so only got half the job done, finally we come to a solution that we made before hand a list of apps here as placeholders, we’ll pick one by one to deliver the app.</p><p>Additionally, we also provide an option to deliver the app to customer’s Apple account, this option will require customers to do some manually steps:<br>- Provide us API key with developer role<br>- Setup the new app on both Apple developer and App store connect</p><p>For <strong>Android</strong>, its much simpler for deploying beta testing app, we just upload it on AWS S3 then its done, and you can use <a href="https://docs.fastlane.tools/actions/s3/">s3 action</a> for it.</p><h4><strong>Conclusion</strong></h4><p>Huge time savings means we can relay the cost savings to our customers.</p><p>Automation within Jenkins allows us to do a lot of very exciting things — automation, auto-review code, alerts, tests, and more!</p><p>The future of our Altitude Apps include new and exciting products and our DevOps solutions will ensure we can continue to innovate with our applications and services.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c88f3a82633" width="1" height="1" alt=""><hr><p><a href="https://medium.com/altitudehq/how-we-customize-and-deliver-our-mobile-app-templates-with-fastlane-jenkins-5c88f3a82633">How we customize and deliver our mobile app templates with fastlane &amp; Jenkins</a> was originally published in <a href="https://medium.com/altitudehq">Altitude</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>