Releasing macOS app on GCP — Part 4

Margaryta Chepiga
Tumiya
Published in
4 min readDec 30, 2019

This is almost the last part of the series, you can find the rest below:

There are still some changes we need to make. We need to give an access to gcloud to execute the commands. In order to do that we need service account credentials.

To get service account credentials, go to your gcp account, from there click on IAM & admin:

Once you are there, click on Service Accounts:

There you should see at least one service account (there is usually a default one that you can use).

Click on it, it will take you to the details page that will look like this:

Click on Edit button at the top of the page, this will allow you to click on +Create Key button:

Choose JSON if it’s not a default choice and click on Create.

New key will appear on the screen and the JSON file will be downloaded on your local machine.

Now, we need to add this key to our bitrise workflow as a variable, for it to be secure. In order to do that, go back to your workflow, from there click on the Secrets:

Once there, click on Add new button:

In the Key section put GCP_KEY_JSON.

In the Value section put the contents of the service account JSON file that you downloaded earlier. All you need to do is open the JSON file, copy it’s content and then paste it as the value on the bitrise. Then click on the Save button.

It will look like screenshot above.

Great! We are good to go to our second script now!

Script #2

In the first script we were downloading gcloud so we could use it to upload the release to the gcp bucket in our second script.

We need to create a second script, because the command will not work in the first script.

We need to add only one line to the second script which is:

gsutil cp $BITRISE_DEPLOY_DIR/SpecChecker.app.zip gs://spec-checker-app/

Where, $BITRISE_DEPLOY_DIR/SpecChecker.app.zip is the executable of your app, that we get from the previous workflow. Please note, SpecChecker.app.zip is the name of my executable, yours will depend on your app name.

Next, gs://spec-checker-app/ is the name of the bucket, you can get the name of your bucket on your gcp page, in the bucket details page.

That’s it! Now, if you trigger the release pipeline, it will generate a release for you and on gcp you will see your app:

If you click on the name, it will take you to the details page:

To get the link to the app downloads, click on Overview:

You can now send this link to anyone who you want to download your app. Make sure to give them access first though, through the Permissions tab.

That’s it! Congratulations of making your own release on via gcp!

--

--

Margaryta Chepiga
Tumiya
Writer for

Software Developer, known as overexcited girl who is passionate about technology