FIRST APP GUIDE
Set Up App Distribution
Let's tackle app store distribution now! It's nice to have this "scary part" out of the way early, so do yourself a favor and take the time to follow this section - even if you're just working with a test app. Getting familiar with the process in this low-pressure environment will make it much less daunting for your real projects.
Getting Codemagic Ready
Initial Setup
Let's get your automated builds configured:
- Connect your GitHub repo to a new Codemagic project
- Pick the Flutter workflow
- Switch to YAML config
Hook Up GitHub
To get those auto-builds working:
- Grab the webhook URL from your Codemagic project
- Add it to your GitHub repo under Settings > Webhooks
Get the Codika Codemagic Config
Codemagic uses workflow files to know how to build your app. We'll help create this file, but first we need to gather some project information:
codika codemagic-get-config
This command adds config fields with default settings in your .codika/config/codika_config.yaml
file.
You'll just need to update two key pieces:
codemagic_app_id
: Your project's ID (find it in the Webhooks section)app_id_ios
: The app ID from App Store Connect for each environment (it's in your app's URL)
Setting Up iOS
First, let's get your app registered with Apple. For each environment (except Development), you'll need to:
- Set up bundle IDs in the Developer Console
- Create provisioning profiles with your certificate
- Create your apps in App Store Connect
- Add an "Internal Testers" group in TestFlight
iOS Signing Setup
Now for the iOS signing magic. Codemagic needs your certificates to build iOS apps:
- Find your
codemagic_provisioning_profile_name
in the config file - Go to Team > Code signing identities > iOS provisioning profiles in Codemagic
- Use "Fetch profiles" to import your certificates
- Match the profile names with what's in your config
Setting Up Android
To allow codemagic to publish your app to the Google Play Store we have to create a service account and provide its JSON key to Codemagic.
Create a service account
- Open the Google Cloud Plateform Console and navigate to your project.
- Enable the
Google Play Developer Reporting API
and theGoogle Play Android Developer API
. - Go to the
APIs & Services
>Credentials
section. - Click on
Create credentials
and selectService account
. - Fill in the required fields and click on
Create
. - Once created, copy the service key email address for later use and click on the service account edit button.
- Go to the
Permission
tab and click onGRANT ACCESS
. - Paste the service key email address in the
New principals
and in theRole
look forService Account User
and press save. - Go to
IAM and admin/Sercice accounts
and in the actions column click onManage keys
. - Click on
Add key/Create new key
and selectJSON
. - Save the JSON file in the root of you project and name it
google-services.json
.
Enable the service account to publish on the Google Play Store
- Open the Google Play Console and navigate to
Users and permissions
. - Click on
Invite new user
and paste the service key email address. - Add the app to which you want to give access to the service account.
- As permissions select
Admin
- Click on
Send invitation
.
Finish Codemagic Setup
Now we can tie everything together:
codika codemagic-setup
This command creates your codemagic.yaml
workflow file and securely uploads all you secret files to Codemagic.
The workflow file tells Codemagic exactly how to build your app for each environment.
Build Time!
With everything configured, let's trigger your first build:
codika build --prod
What's Next?
Great job! You've accomplished quite a bit:
- Set up your app in the Apple Developer Console
- Created your Codemagic build pipeline
- Got your first build ready for testing
In the next section, we'll add a new feature to your app using the Codika CLI. We'll integrate the FAQ block - a simple feature that lets you add a FAQ section to your app.
We've specifically chosen this feature for the next step because it's the perfect way to show you how Codika works under the hood. You'll explore the architecture, see DDD in action, and check out all the cool automations that make your life easier. After that, we'll use Shorebird to deploy this new feature to your users through a live update - no app store submission needed!