Continuously deploy to Expo with Amazon CodeBuild

Olalekan Elesin
May 17 · 3 min read
Image for post
Image for post

This is going to be a really short post on what I learned in the past one week. For the past one week, I had been working on a mobile application to help women differentiate between synthetic and human hair extensions using artificial intelligence. Basically, operationalizing my image classification model trained on Amazon SageMaker. I will write about the details of the mobile application in a later post, however let me give you a hint of the technologies in the mix:

As with any side project, one learns as many technologies as possible. Putting all these together and getting the mobile application into the hands of early users rapidly in order to validate the idea. To be clear, this is not the first MVP. I already built a clickable prototype:

The mobile application is a high fidelity prototype which is based on feedback from interviewing a handful of customers.

Continuous Deployment with Amazon CodeBuild

To validate my app idea with real users as quickly as possible with high fidelity, it is important to continuous deploy changes to users rapidly and collect feedback. Expo documentation provides references on how to continuously deploy with Travis CI, GitLab CI and BitBucket pipelines but nothing on Amazon CodeBuild. Hence, decided to learn.

Expo CLI requires authentication before publishing my application. This needed to be handled securely by not exposing my password to GitHub. Amazon Systems Manager Parameter Store to the rescue. With my password securely saved, I can now authenticate and publish to Expo at build time by accessing my password with a simple AWS CLI shell command.

Putting it all together with Amazon CodeBuild buildspec.yaml file:

version: 0.2env:
variables:
EXPO_USERNAME: <my-expo-username>
phases:
install:
runtime-versions:
nodejs: 10

pre_build:
commands:
- npm install
- echo "Installing Expo"
- npm install --save-dev -g expo-cli
- expo --version
- export EXPO_CLI_PASSWORD=$(aws ssm get-parameter --name "expo-cli-password" --region <my-aws-region> --query 'Parameter.Value' --output text)
- npx expo login --non-interactive -u ${EXPO_USERNAME}
build:
commands:
- echo "Executing NPM Build for production"
- npx expo publish --non-interactive --release-channel dev-${CODEBUILD_BUILD_NUMBER}
post_build:
commands:
- echo "publishing to expo default channel"
- npx expo publish --non-interactive

Learnings and Next Steps

My last experience publishing applications to Expo was quite interesting as I always had to ensure my laptop did not go into sleep mode, or internet connection loss for some weird reason. With continuous deployment in place, I only have to push my changes to the source code repository on GitHub, and in ~15 mins, changes are live on Expo. Now, I can continuous release improvements and features to users rapidly.

One next step would be automating publishing to Google Play Store.

Here’s my clickable demo below:

The Startup

Medium's largest active publication, followed by +730K people. Follow to join our community.

Olalekan Elesin

Written by

Product Person, AWS Certified SA, Associate. Lover of scientific experiments and love to get my hands dirty with code…

The Startup

Medium's largest active publication, followed by +730K people. Follow to join our community.

Olalekan Elesin

Written by

Product Person, AWS Certified SA, Associate. Lover of scientific experiments and love to get my hands dirty with code…

The Startup

Medium's largest active publication, followed by +730K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store