cloudsmith-io / action

Github Action that uses the cloudsmith cli to interact with the Cloudsmith API (pushes, etc)
https://github.com/marketplace/actions/cloudsmith-push
MIT License
15 stars 12 forks source link

Multiple/wildcard upload #21

Open slonopotamus opened 3 years ago

slonopotamus commented 3 years ago

Is it possible to upload multiple files in one go?

My project produces several .deb files, all of them need to be published.

Ideally, I'd like to do something like

    steps:
      - name: Publish to Cloudsmith.io
        uses: cloudsmith-io/action@master
        with:
          command: "push"
          format: "deb"
          <snip>
          file: "build/*.deb"

Even if multiple files are not supported, it is still not clear how to specify file when file name is dynamically generated (like, it contains version number in its name).

kepstin commented 2 years ago

The current action can't handle multiple packages at once (this is maybe something that could be added to the cloudsmith cli tool itself rather than the action?) but wildcards do work, you can do something like:

  file: debian/artifacts/package-name_*_amd64.deb

to publish a package regardless of the possibly generated version number.

You could also have a step which saves the package version to an env variable, like

- run: echo "PACKAGE_VERSION=$(dpkg-parsechangelog -S version)" >> $GITHUB_ENV

- uses: cloudsmith-io/action@master
  with:
    file: debian/artifacts/package-name_${{ env.PACKAGE_VERSION }}_amd64.deb
maidul98 commented 1 year ago

+1 this should added

KitsuneRal commented 1 year ago

@kepstin Not sure it actually works the way you intended. I'm trying to pass a file retrieved by actions/download-artifact using something like ${{ steps.download-artifact.outputs.download-path }}/* for file (there's exactly one file at the path). GitHub Actions does what it should with the output part and then, judging by the build logs, the path is handed over to Cloudsmith CLI without expanding the wildcard. Not sure why that happens, actually... Bash eval should expand globs at this point, unless glob expansion is turned off. But I clearly see in the preceding echo output that the asterisk remains, as if it were escaped when passed inside the script. The relevant build logs can be found here, if you're interested.

modem7 commented 1 year ago

Allowing for multiple files to be uploaded would be exceedingly useful.

For example, using cibuildwheel to create python wheels for multiple architectures and/or python versions would output multiple files in a single build run (e.g. https://github.com/modem7/cibuildwheel/actions/runs/4298866331), which would need to be uploaded.

Currently, I have to wait for the run to complete, download the files, and then use the cli to upload to cloudsmith, which is rather cumbersome (even more so because the CLI also doesn't support multiple files).

JonasVautherin commented 1 year ago

this is maybe something that could be added to the cloudsmith cli tool itself rather than the action?

Would that then translate "transparently" to the action? And do you know if there is an open issue for that, by any chance?