google-github-actions / upload-cloud-storage

A GitHub Action for uploading files to a Google Cloud Storage (GCS) bucket.
https://cloud.google.com/storage
Apache License 2.0
223 stars 50 forks source link

"uploading a file" example in README seems wrong #353

Closed exoego closed 5 months ago

exoego commented 7 months ago

TL;DR

I've followed the "uploading a file" example but the file was uploaded to bucket-name/file-name/file-name. This example: https://github.com/google-github-actions/upload-cloud-storage/blob/22121cd842b0d185e042e28d969925b538c33d77/README.md#L51-L55

Expected behavior

The file build/native/nativeCompile/my-app.exe is uploaded to my-bucket/my-app.exe

Observed behavior

The file build/native/nativeCompile/my-app.exe was uploaded to my-bucket/my-app.exe/my-app.exe

Action YAML

name: build
on:
  push:
    branches: [master]
  workflow_dispatch:

jobs:
  build-windows-native-image:
    permissions:
      contents: 'read'
      id-token: 'write'
    runs-on: windows-2022
    steps:
      - uses: actions/checkout@v4
      - uses: graalvm/setup-graalvm@v1
        with:
          java-version: '17'
          distribution: 'graalvm-community'
          components: 'native-image'
          native-image-job-reports: 'true'
          github-token: ${{ secrets.GITHUB_TOKEN }}
      - name: Build native image
        uses: gradle/actions/setup-gradle@v3
        with:
          arguments: nativeCompile
      - uses: google-github-actions/auth@v2
        name: Login to GCP
        with:
          workload_identity_provider: "projects/***/locations/global/workloadIdentityPools/***/providers/***"
          service_account: "***@***.iam.gserviceaccount.com"
          token_format: access_token
      - uses: google-github-actions/upload-cloud-storage@v2
        name: Upload to Cloud Storage
        with:
          path: 'build/native/nativeCompile/my-app.exe'
          destination: 'my-bucket/my-app.exe'

Log output

No response

Additional information

sethvargo commented 7 months ago

Hi there - could you please provide the debug output for the complete GitHub Actions workflow run?

rtibbles commented 5 months ago

I had a similar experience when following the instructions from the README. The log for the action step is first the inputs:

Run google-github-actions/upload-cloud-storage@v2
  with:
    path: dist/kolibri-0.16.0-py.py3-none-any.whl
    destination: ***/downloads/kolibri/v0.16.0/kolibri-0.16.0-py2.py-none-any.whl
    gzip: true
    resumable: true
    parent: true
    concurrency: 100
    process_gcloudignore: true

Then the actual upload, you can see puts the filename in a folder called the filename. I am guessing that actually specifying the filename in this way isn't supported, or requires a different argument? Either way, that's not what the README shows.

Upload files
  Uploading /home/runner/work/kolibri/kolibri/dist/kolibri-0.16.0-py2.py3-none-any.whl to gs://***/downloads/kolibri/v0.16.0/kolibri-0.16.0-py2.py3-none-any.whl/kolibri-0.16.0-py2.py3-none-any.whl