Flutter in Bitrise: Zero to Hero — Code Signing (2/3)

Leonardo Alexandre de Geus
4 min readFeb 12, 2019

--

This is the second part of a two parts tutorial, the first one you can see in the follow link. So, let’s continue!

Signing the code in Bitrise — iOS

To deploy the app, we need to code signing our code in Bitrise. In developer Apple page you can find a definition for Code Signing:

Code signing your app assures users that it is from a known source and the app hasn’t been modified since it was last signed. Before your app can integrate app services, be installed on a device, or be submitted to the App Store, it must be signed with a certificate issued by Apple.

This is necessary both Itunes Connect and Google Play. In order to do this we need to generate four files, the iOS files are automatically delivered to the service, however the Android files need to be done mannualy. This tutorial part will explain all process. Let’s go!

1. First of all, enter in Bitrise project and click on Workflow button, after that the Workflow Editor will open.

Workflow button

2. Click on Code Signing tab in top menu and copy the code:

bash -l -c “$(curl -sfL https://raw.githubusercontent.com/bitrise-tools/codesigndoc/master/_scripts/install_wrap.sh)"

3. Open a terminal on Mac, paste the code and wait until the process is over. After the download is completed, drag and drop the file ios/Runner.xcworkspace inside the terminal and press Enter/return key.

Drag and drop .xcworkspace file

4. When the options appears, select the app-store typing 2. After that, type no, to decline others files upload.

5. Type yes to upload provising profile automatically to Bitrise.

6. The system will request a Personal Access Token, you can acquire it from Account settings menu, in Security tab. Generate a new one, copy and paste on terminal to finished the certificates upload.

Security Tab

7. Select your project respective number, and press enter/return key to confirm.

8. The iOS code signing is ready.

Signing the code in Bitrise — Android

In Android we need to follow some manual steps:

1. Open the Mac terminal and type the follow line, replacing alias_name with a known name, e.g.: MyKey. Keep this name save, we'll need it.

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

2. When request, type a password, remember to save this in a safe place, we’ll need it too.

3. After that, the system will request some informations, type about your company and answer yes to finished the keystore creation. To finish the process, the system will request a password again, type it.

4. Depending where you iniciatilizate the terminal, the key my-release-key.keystore will be created. Now, go to the Code Signing tab on
Workflow Editor in Bitrise and upload the key you created on ANDROID KEYSTORE FILE section.

5. Bitrise will request the alias name and the passwords that you created to generate the keystore file. Fill the blanks with the informations and click Save metadata to confirm.

6. Now, we need to upload the Service Account JSON key file to allow the app publication on Google Play account. Go to the this site https://play.google.com/apps/publish/ and click on Configurations tab. After that, click on API Access button.

7. Scroll to the bottom and click on Create a service account button to generate a new service account. When the popup appears, click on the link Google API console. There, create a service account with full permissions (Owner Permission), finally create a json key.

8. Back to Code Signing tab on Bitrise, and upload this json file with name SERVICE_ACCOUNT_JSON_KEY on GENERIC FILE STORAGE section.

Service account JSON key

For now, we have a bitrise project ready to deploy, with all the certificates and files uploaded. The last one is the final part, we'll upload the app automatically to Test Flight and Google Play using the Bitrise CI/CD system. You can find the next part of the tutorial at the following link:

Thanks!

Let me know your thoughts or feedback in the comments below, or access my website in http://leodegeus.com

--

--

No responses yet