Gcloud installation / google storage upload

how can I install gcloud on hybrid stack, so I can upload files to google storage?

1 Like

I will answer myself, hoping someone else might find it useful. Here is a script that works.


  1. generate a gcloud key.json file, and upload it in the code signings section (workflow screen) - in the generic file section (bottom) and save it as BITRISEIO_GCLOUD_JSON_URL

  2. Have a storage bucket ready and store its name in the GCLOUD_APP_PATH env variable. This is the gs://ā€¦ bucket path. (This is optional, to make this script nice. You can paste the path in the script and skip this part).

     set -ex
     # install gcloud on a hybrid stack (i.e. mac. Other stacks may have it pre installed)
     curl https://sdk.cloud.google.com | bash 
     source $HOME/google-cloud-sdk/path.bash.inc
     # just checking that gcloud command works - remove it if you like. 
     gcloud version
     # Download the key file stored earlier
     curl -o /tmp/gcloud.json $BITRISEIO_GCLOUD_JSON_URL
     # Use the file for authentication
     gcloud auth activate-service-account -q --key-file /tmp/gcloud.json
     # taking pakage version from package.json, but any versioning will work
     PACKAGE_VERSION=$(node -p "require('./package.json').version")
     # Building the target path. Any scheme will do... 
    # Copy the file from previous step into the target
     gsutil cp  ${BITRISE_IPA_PATH} ${TARGET}

Note, downloading is working exactly the same way, just reverse the order of the source and target in gsutil cp.


Hex @tbarak, thanks for sorting this out!

Iā€™m sure it will be useful for plenty of our users stumbling into the same issue :slightly_smiling_face:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.