如何设置位触发将文件上传到Google云存储桶

时间:2019-03-26 15:54:32

标签: google-cloud-platform google-cloud-storage bitrise

我正在尝试为基于HTML的网站在bitrise上添加一个新应用。 我试图在bitrise上添加新应用,但是我不知道如何将新应用设置为Google存储上的静态网站。 当将代码推送到bitbucket存储库时,有没有办法在bitrise上设置触发器以将文件和目录上传到Google云存储桶? 谢谢!

1 个答案:

答案 0 :(得分:0)

您应该能够通过脚本使用例如已预先安装在Linux堆栈https://cloud.google.com/sdk/gcloud/

上的Google Cloud CLI

https://cloud.google.com/storage/docs/uploading-objects包含gsutil的示例。

使用服务帐户进行身份验证:https://cloud.google.com/sdk/gcloud/reference/auth/activate-service-account 注意:您可以使用Bitrise通用文件存储来存储服务帐户json密钥文件:https://devcenter.bitrise.io/tutorials/how-to-use-the-generic-file-storage/#uploading-files-to-generic-file-storage-on-bitriseio

基本工作流程如下:

  1. SSH Auth和Git Clone步骤,以下载代码
  2. File Downloader步骤下载服务帐户JSON文件(您上传到通用文件存储中的文件:https://devcenter.bitrise.io/tutorials/how-to-use-the-generic-file-storage/#uploading-files-to-generic-file-storage-on-bitriseio)。另外,如果您想以加密形式存储它,则可以按照指南(https://devcenter.bitrise.io/tutorials/how-to-use-the-generic-file-storage/#using-the-files-uploaded-to-generic-file-storage-on-bitriseio)中所述使用Decrypt file步骤
  3. 然后执行Script步骤,在该步骤中您激活/认证服务帐户文件(https://cloud.google.com/sdk/gcloud/reference/auth/activate-service-account),然后以任意方式使用gcloud / gsutil
相关问题