{"id":13485178,"url":"https://github.com/google-github-actions/upload-cloud-storage","last_synced_at":"2025-05-14T14:10:02.821Z","repository":{"id":37467737,"uuid":"308778055","full_name":"google-github-actions/upload-cloud-storage","owner":"google-github-actions","description":"A GitHub Action for uploading files to a Google Cloud Storage (GCS) bucket.","archived":false,"fork":false,"pushed_at":"2025-02-01T14:14:05.000Z","size":7540,"stargazers_count":244,"open_issues_count":1,"forks_count":47,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-05T19:12:46.603Z","etag":null,"topics":["actions","gcp","gcs","github-actions","google-cloud","google-cloud-platform","google-cloud-storage"],"latest_commit_sha":null,"homepage":"https://cloud.google.com/storage","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google-github-actions.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-31T01:09:32.000Z","updated_at":"2025-04-14T17:52:15.000Z","dependencies_parsed_at":"2023-01-11T17:21:15.240Z","dependency_job_id":"3cee3b80-24b4-4823-8be2-7d36b1087fbc","html_url":"https://github.com/google-github-actions/upload-cloud-storage","commit_stats":{"total_commits":201,"total_committers":11,"mean_commits":"18.272727272727273","dds":0.6716417910447761,"last_synced_commit":"386ab77f37fdf51c0e38b3d229fad286861cc0d0"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Fupload-cloud-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Fupload-cloud-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Fupload-cloud-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-github-actions%2Fupload-cloud-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google-github-actions","download_url":"https://codeload.github.com/google-github-actions/upload-cloud-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254160555,"owners_count":22024571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","gcp","gcs","github-actions","google-cloud","google-cloud-platform","google-cloud-storage"],"created_at":"2024-07-31T17:01:49.231Z","updated_at":"2025-05-14T14:09:57.812Z","avatar_url":"https://github.com/google-github-actions.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# upload-cloud-storage\n\nThe `upload-cloud-storage` GitHub Action uploads files to a [Google Cloud\nStorage (GCS)][gcs] bucket.\n\nPaths to files that are successfully uploaded are set as output variables and\ncan be used in subsequent steps.\n\n**This is not an officially supported Google product, and it is not covered by a\nGoogle Cloud support contract. To report bugs or request features in a Google\nCloud product, please contact [Google Cloud\nsupport](https://cloud.google.com/support).**\n\n## Prerequisites\n\n-   This action requires Google Cloud credentials that are authorized to upload\n    blobs to the specified bucket. See the [Authorization](#authorization)\n    section below for more information.\n\n-   This action runs using Node 16. If you are using self-hosted GitHub Actions\n    runners, you must use runner version [2.285.0](https://github.com/actions/virtual-environments)\n    or newer.\n\n## Usage\n\n\u003e **⚠️ WARNING!** The Node.js runtime has [known issues with unicode characters\n\u003e in filepaths on Windows][nodejs-unicode-windows]. There is nothing we can do\n\u003e to fix this issue in our GitHub Action. If you use unicode or special\n\u003e characters in your filenames, please use `gsutil` or `gcloud` to upload\n\u003e instead.\n\n### For uploading a file\n\n```yaml\njobs:\n  job_id:\n    permissions:\n      contents: 'read'\n      id-token: 'write'\n\n    steps:\n    - id: 'checkout'\n      uses: 'actions/checkout@v4'\n\n    - id: 'auth'\n      uses: 'google-github-actions/auth@v2'\n      with:\n        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'\n        service_account: 'my-service-account@my-project.iam.gserviceaccount.com'\n\n    - id: 'upload-file'\n      uses: 'google-github-actions/upload-cloud-storage@v2'\n      with:\n        path: '/path/to/file'\n        destination: 'bucket-name'\n\n    # Example of using the output\n    - id: 'uploaded-files'\n      uses: 'foo/bar@v1'\n      env:\n        file: '${{ steps.upload-file.outputs.uploaded }}'\n```\n\nThe file will be uploaded to `gs://bucket-name/file`\n\n### For uploading a folder\n\n```yaml\njobs:\n  job_id:\n    permissions:\n      contents: 'read'\n      id-token: 'write'\n\n    steps:\n    - id: 'checkout'\n      uses: 'actions/checkout@v4'\n\n    - id: 'auth'\n      uses: 'google-github-actions/auth@v2'\n      with:\n        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'\n        service_account: 'my-service-account@my-project.iam.gserviceaccount.com'\n\n    - id: 'upload-folder'\n      uses: 'google-github-actions/upload-cloud-storage@v2'\n      with:\n        path: '/path/to/folder'\n        destination: 'bucket-name'\n\n    # Example of using the output\n    - id: 'uploaded-files'\n      uses: 'foo/bar@v1'\n      env:\n        files: '${{ steps.upload-folder.outputs.uploaded }}'\n```\n\n## Destination Filenames\n\nIf the folder has the following structure:\n\n```text\n.\n└── myfolder\n    ├── file1\n    └── folder2\n        └── file2.txt\n```\n\n### Default Configuration\n\nWith default configuration\n\n```yaml\n- id: 'upload-files'\n  uses: 'google-github-actions/upload-cloud-storage@v2'\n  with:\n    path: 'myfolder'\n    destination: 'bucket-name'\n```\n\nThe files will be uploaded to `gs://bucket-name/myfolder/file1`,`gs://bucket-name/myfolder/folder2/file2.txt`\n\nOptionally, you can also specify a prefix in destination.\n\n```yaml\n- id: 'upload-files'\n  uses: 'google-github-actions/upload-cloud-storage@v2'\n  with:\n    path: 'myfolder'\n    destination: 'bucket-name/myprefix'\n```\n\nThe files will be uploaded to `gs://bucket-name/myprefix/myfolder/file1`,`gs://bucket-name/myprefix/myfolder/folder2/file2.txt`\n\n### Upload to bucket root\n\nTo upload `myfolder` to the root of the bucket, you can set `parent` to false.\nSetting `parent` to false will omit `path` when uploading to bucket.\n\n```yaml\n- id: 'upload-files'\n  uses: 'google-github-actions/upload-cloud-storage@v2'\n  with:\n    path: 'myfolder'\n    destination: 'bucket-name'\n    parent: false\n```\n\nThe files will be uploaded to `gs://bucket-name/file1`,`gs://bucket-name/folder2/file2.txt`\n\nIf path was set to `myfolder/folder2`, the file will be uploaded to `gs://bucket-name/file2.txt`\n\nOptionally, you can also specify a prefix in destination.\n\n```yaml\n- id: 'upload-files'\n  uses: 'google-github-actions/upload-cloud-storage@v2'\n  with:\n    path: 'myfolder'\n    destination: 'bucket-name/myprefix'\n    parent: false\n```\n\nThe files will be uploaded to `gs://bucket-name/myprefix/file1`,`gs://bucket-name/myprefix/folder2/file2.txt`\n\n### Glob Pattern\n\nYou can specify a glob pattern like\n\n```yaml\n- id: 'upload-files'\n  uses: 'google-github-actions/upload-cloud-storage@v2'\n  with:\n    path: 'myfolder'\n    destination: 'bucket-name'\n    glob: '**/*.txt'\n```\n\nThis will particular pattern will match all text files within `myfolder`.\n\nIn this case, `myfolder/folder2/file2.txt` is the only matched file and will be uploaded to `gs://bucket-name/myfolder/folder2/file2.txt`.\n\nIf `parent` is set to `false`, it wil be uploaded to `gs://bucket-name/folder2/file2.txt`.\n\n## Inputs\n\n\u003c!-- BEGIN_AUTOGEN_INPUTS --\u003e\n\n-   \u003ca name=\"project_id\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-project_id\"\u003e\u003ccode\u003eproject_id\u003c/code\u003e\u003c/a\u003e: _(Optional)_ Google Cloud project ID to use for billing and API requests. If not\n    provided, the project will be inferred from the environment, best-effort.\n    To explicitly set the value:\n\n    ```yaml\n    project_id: 'my-project'\n    ```\n\n-   \u003ca name=\"universe\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-universe\"\u003e\u003ccode\u003euniverse\u003c/code\u003e\u003c/a\u003e: _(Optional, default: `googleapis.com`)_ The Google Cloud universe to use for constructing API endpoints. Trusted\n    Partner Cloud and Google Distributed Hosted Cloud should set this to their\n    universe address.\n\n    You can also override individual API endpoints by setting the environment\n    variable `GHA_ENDPOINT_OVERRIDE_\u003cendpoint\u003e` where `\u003cendpoint\u003e` is the API\n    endpoint to override. For example:\n\n    ```yaml\n    env:\n      GHA_ENDPOINT_OVERRIDE_oauth2: 'https://oauth2.myapi.endpoint/v1'\n    ```\n\n    For more information about universes, see the Google Cloud documentation.\n\n-   \u003ca name=\"path\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-path\"\u003e\u003ccode\u003epath\u003c/code\u003e\u003c/a\u003e: _(Required)_ The path to a file or folder inside the action's filesystem that should be\n    uploaded to the bucket.\n\n    You can specify either the absolute path or the relative path from the\n    action:\n\n    ```yaml\n    path: '/path/to/file'\n    ```\n\n    ```yaml\n    path: '../path/to/file'\n    ```\n\n-   \u003ca name=\"destination\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-destination\"\u003e\u003ccode\u003edestination\u003c/code\u003e\u003c/a\u003e: _(Required)_ The destination for the file/folder in the form bucket-name or with an\n    optional prefix in the form `bucket-name/prefix`. For example, to upload a\n    file named `file` to the GCS bucket `bucket-name`:\n\n    ```yaml\n    destination: 'bucket-name'\n    ```\n\n    To upload to a subfolder:\n\n    ```yaml\n    destination: 'bucket-name/prefix'\n    ```\n\n-   \u003ca name=\"gzip\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-gzip\"\u003e\u003ccode\u003egzip\u003c/code\u003e\u003c/a\u003e: _(Optional, default: `true`)_ Upload file(s) with gzip content encoding. To disable gzip\n    content-encoding, set the value to false:\n\n    ```yaml\n    gzip: false\n    ```\n\n-   \u003ca name=\"resumable\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-resumable\"\u003e\u003ccode\u003eresumable\u003c/code\u003e\u003c/a\u003e: _(Optional, default: `true`)_ Enable resumable uploads. To disable resumable uploads, set the value to\n    false:\n\n    ```yaml\n    resumable: false\n    ```\n\n-   \u003ca name=\"predefinedAcl\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-predefinedAcl\"\u003e\u003ccode\u003epredefinedAcl\u003c/code\u003e\u003c/a\u003e: _(Optional)_ Apply a predefined set of access controls to the files being uploaded. For\n    example, to grant project team members access to the uploaded files\n    according to their roles:\n\n    ```yaml\n    predefinedAcl: 'projectPrivate'\n    ```\n\n    Acceptable values are: `authenticatedRead`, `bucketOwnerFullControl`,\n    `bucketOwnerRead`, `private`, `projectPrivate`, `publicRead`. See [the\n    document](https://googleapis.dev/nodejs/storage/latest/global.html#UploadOptions)\n    for details.\n\n-   \u003ca name=\"headers\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-headers\"\u003e\u003ccode\u003eheaders\u003c/code\u003e\u003c/a\u003e: _(Optional)_ Set object metadata. For example, to set the `Content-Type` header to\n    `application/json` and custom metadata with key `custom-field` and value\n    `custom-value`:\n\n    ```yaml\n    headers: |-\n      content-type: 'application/json'\n      x-goog-meta-custom-field: 'custom-value'\n    ```\n\n    Settable fields are: `cache-control`, `content-disposition`,\n    `content-encoding`, `content-language`, `content-type`, `custom-time`. See\n    [the\n    document](https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadata#settable-fields;-field-values)\n    for details. All custom metadata fields must be prefixed with\n    `x-goog-meta-`.\n\n-   \u003ca name=\"parent\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-parent\"\u003e\u003ccode\u003eparent\u003c/code\u003e\u003c/a\u003e: _(Optional, default: `true`)_ Whether the parent directory should be included in GCS destination path. To disable this:\n\n    ```yaml\n    parent: false\n    ```\n\n-   \u003ca name=\"glob\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-glob\"\u003e\u003ccode\u003eglob\u003c/code\u003e\u003c/a\u003e: _(Optional)_ Glob pattern to match for files to upload.\n\n    ```yaml\n    glob: '*.txt'\n    ```\n\n-   \u003ca name=\"concurrency\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-concurrency\"\u003e\u003ccode\u003econcurrency\u003c/code\u003e\u003c/a\u003e: _(Optional, default: `100`)_ Number of files to simultaneously upload.\n\n    ```yaml\n    concurrency: '10'\n    ```\n\n-   \u003ca name=\"gcloudignore_path\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-gcloudignore_path\"\u003e\u003ccode\u003egcloudignore_path\u003c/code\u003e\u003c/a\u003e: _(Optional, default: `.gcloudignore`)_ Path to a gcloudignore file within the repository.\n\n    ```yaml\n    gcloudignore_path: '.gcloudignore.dev'\n    ```\n\n-   \u003ca name=\"process_gcloudignore\"\u003e\u003c/a\u003e\u003ca href=\"#user-content-process_gcloudignore\"\u003e\u003ccode\u003eprocess_gcloudignore\u003c/code\u003e\u003c/a\u003e: _(Optional, default: `true`)_ Process a `.gcloudignore` file present in the top-level of the repository.\n    If true, the file is parsed and any filepaths that match are not uploaded\n    to the storage bucket. To disable, set the value to false:\n\n    ```yaml\n    process_gcloudignore: false\n    ```\n\n\n\u003c!-- END_AUTOGEN_INPUTS --\u003e\n\n\n## Outputs\n\n\u003c!-- BEGIN_AUTOGEN_OUTPUTS --\u003e\n\n-   `uploaded`: Comma-separated list of files that were uploaded.\n\n\n\u003c!-- END_AUTOGEN_OUTPUTS --\u003e\n\n\n## Authorization\n\nThere are a few ways to authenticate this action. The caller must have\npermissions to access the secrets being requested.\n\n### Via google-github-actions/auth\n\nUse [google-github-actions/auth](https://github.com/google-github-actions/auth)\nto authenticate the action. You can use [Workload Identity Federation][wif] or\ntraditional [Service Account Key JSON][sa] authentication.\n\n```yaml\njobs:\n  job_id:\n    permissions:\n      contents: 'read'\n      id-token: 'write'\n\n    steps:\n    - id: 'auth'\n      uses: 'google-github-actions/auth@v2'\n      with:\n        workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'\n        service_account: 'my-service-account@my-project.iam.gserviceaccount.com'\n\n    - uses: 'google-github-actions/upload-cloud-storage@v2'\n```\n\n### Via Application Default Credentials\n\nIf you are hosting your own runners, **and** those runners are on Google Cloud,\nyou can leverage the Application Default Credentials of the instance. This will\nauthenticate requests as the service account attached to the instance. **This\nonly works using a custom runner hosted on GCP.**\n\n```yaml\njobs:\n  job_id:\n    steps:\n    - id: 'upload-file'\n      uses: 'google-github-actions/upload-cloud-storage@v2'\n```\n\nThe action will automatically detect and use the Application Default\nCredentials.\n\n[gcs]: https://cloud.google.com/storage\n[wif]: https://cloud.google.com/iam/docs/workload-identity-federation\n[sa]: https://cloud.google.com/iam/docs/creating-managing-service-accounts\n[nodejs-unicode-windows]: https://github.com/nodejs/node/issues/48673\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-github-actions%2Fupload-cloud-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle-github-actions%2Fupload-cloud-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-github-actions%2Fupload-cloud-storage/lists"}