Photo by Shane Aldendorff

Update your mobile application package informations automatically with GitHub Actions

Dynamically change the package informations

Posted by Damien Aicheh on 07/22/2021 · 3 mins

When developing a mobile application you often needs to update the packages information of your application. For instance:

  • Update the package name or bundle identifier of your application
  • Change your application name which can be useful when doing different build types for staging, production…

This kind of actions can be done during the execution of your workflow inside your GitHub Actions, let’s see how!

Introducing new GitHub Actions

To achieve this goal I developed a new set of free GitHub Actions, available on the GitHub Marketplace to use in your workflows. These actions are compatible with any type of iOS or Android projects.

Here there are:

Usage

To use one of these actions it’s easy, follow one of the links above and then click on Use latest version button. This will prompt a dialog with the yaml code to use it.

Use action

Update your Android package

The first action allows us to update the package name and the name of your application with a few lines:

- name: Update AndroidManifest.xml
  uses: damienaicheh/update-android-manifest-package-action@v1.0.0
  with:
    android-manifest-path: './path_to_your/AndroidManifest.xml'
    package-name: 'com.mycompany.demo'
    app-name: 'Demo App'
    print-file: true

This will update the AndroidManifest.xml with the new package name: com.mycompany.demo and a new name for this app: Demo App. You can also print this file before and after modifing it by setting the print-file property to true.

Update your iOS package

The next action allows us to update the bundle identifier and the application name:

- name: Update Bundle identifier
  uses: damienaicheh/update-ios-bundle-identifier-action@v1.0.0
  with:
    info-plist-path: './path_to_your/Info.plist'
    bundle-identifier: 'com.mycompany.demo'
    bundle-name: 'Demo'
    bundle-display-name: 'Demo App'
    print-file: true

This will update the Info.plist of your project with the new bundle identifier: com.mycompany.demo and a new name for this app: Demo App. Like the previous action tou can print this file in the console before and after modifing it by setting the print-file property to true.

Final touch

These actions will help you automatically update the package informations of your mobile projects using GitHub Actions. Feel free to contribute to improve these actions project if you want.

Happy coding!

Do not hesitate to follow me on to not miss my next tutorial!