ryand56 / r2-upload-action

GitHub Action to upload files or directories to a Cloudflare R2 bucket (or another S3 compatible API), built on top of @aws-sdk/client-s3 in TypeScript.
MIT License
32 stars 24 forks source link

Feature: Provide multiple files to upload #472

Open Edouard127 opened 2 days ago

Edouard127 commented 2 days ago

I am using this action in order to upload artifacts to my R2 Bucket and I've come into the following issue:

You cannot upload multiple files from different folders in one go like this

      - name: Upload Files
        uses: ryand56/r2-upload-action@latest
        with:
          r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
          r2-access-key-id: ${{ secrets.R2_ACCESS_KEY }}
          r2-secret-access-key: ${{ secrets.R2_ACCESS_SECRET }}
          r2-bucket: ${{ secrets.R2_BUCKET_NAME }}
          source-dir: |
              './file1.jar'
              './file2.jar'
              './file3.jar'
          destination-dir: ${{ env.DATE }}-${{ env.COMMIT_HASH }}

In this case, the directory provided to https://github.com/ryand56/r2-upload-action/blob/master/src/utils.ts#L20 is as follow: "./file1.jar\n" + "./file2.jar\n" + "./file3.jar"

Implementation of such feature is fairly simple, check if the string contains \n, if so, recursively run the function for each split path

ryand56 commented 2 days ago

Okay, I'll implement this later today. Thanks for letting me know!

Edouard127 commented 2 days ago

While you're at it you can add support to upload multiple folders at a time

Avanatiker commented 2 days ago

Much needed!

ryand56 commented 2 days ago

I'm having some issues implementing this now as the issue related to #440 has returned If someone can figure out a better way to implement this, that would be greatly appreciated as I'm busy with studies right now