Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple paths? #55

Closed
bonesoul opened this issue Feb 14, 2020 · 17 comments
Closed

multiple paths? #55

bonesoul opened this issue Feb 14, 2020 · 17 comments
Labels
enhancement New feature or request

Comments

@bonesoul
Copy link

is multiple paths supported?

@jpfeuffer
Copy link

Can anyone comment on if this is currently possible?

@konradpabjan
Copy link
Collaborator

konradpabjan commented Mar 14, 2020

With v1 it is not currently possible.

v2 is right around the corner though and once it is out of preview, support can be added for multiple paths 😀

v2-preview is relying on core.getInput() to get the path input. https://github.com/actions/toolkit/tree/master/packages/core#inputsoutputs

Officially, there is no way to get multiple inputs at once from YAML (something like core.getInputs()) but there are plans to support this in the future: actions/toolkit#184

While we wait for official support, we can use a hack (similar to what @actions/cache has done) to support multiple path inputs: actions/cache#44

@Krenodeno
Copy link

It would be a very big improvement to support path like it is demonstrated here:
https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#patterns-to-match-file-paths

I'm particularly interested in the latter ones, that could look like this:

path:
  - /first/path/file.ext
  - /second/path/file.ext # take this one if the first is not found

@ShiraazMoollatjie
Copy link

ShiraazMoollatjie commented Apr 27, 2020

What will also be nice is to specify glob patterns too. So something like:

path:
  - /releases/**/*.apk

@eine
Copy link

eine commented Apr 28, 2020

Now that #3 is published (:tada:), I guess this is the main remaining feature requested/proposed in #3 (comment):

  with:
    title: my-artifacts
      - files: [ path/to/artifact.tar.gz ]
      - name: "Packages"
        files: [ path/to/rpms/*.rpm,  path/to/debs/*.deb ]
      - name: "Docs"
        files: [ "README.md", path/to/docs, !path/to/docs/tmp ]

@zhangyoufu
Copy link

To make it clear, you can already upload from multiple paths with \n. (the "hack" metioned above)

The path input is directly passed to actions/glob, and actions/glob supports multiple patterns separated by \n.

      uses: actions/upload-artifact@v2
      with:
        name: artifact-name
        path: |
          aaa
          bbb
          ccc

PS: actions/glob pattern is very powerful, see https://github.com/actions/toolkit/tree/master/packages/glob#patterns.

@konradpabjan
Copy link
Collaborator

not quite @zhangyoufu

If all the files are in the same working dir then it will work, however if you have a mix it will fail with Only 1 search path should be returned

Multiple search paths start to come up and that messes with the rootDirectory that gets used from the search result. I left a comment here a while back ago:

Only a single search pattern is being included so only 1 searchResult is expected. In the future if multiple search patterns are

atsushieno added a commit to atsushieno/aap-core that referenced this issue Jun 30, 2020
@brandonros
Copy link

can we do this yet or not?

- uses: actions/upload-artifact@v2
  with:
    name: ${{ matrix.os }}
    paths:
      - 1
      - 2
      - 3

@ax4
Copy link

ax4 commented Jul 10, 2020

can we do this yet or not?

- uses: actions/upload-artifact@v2
  with:
    name: ${{ matrix.os }}
    paths:
      - 1
      - 2
      - 3

Hi @brandonros! As PR#94 has been created 13 hours ago and merged 5 hours ago, now the multiple paths can be done (in yml/yaml file) with | creating new lines. See example at https://github.com/actions/upload-artifact/blame/master/README.md#L59-L69

Thank @konradpabjan so much for the work! Appreciate!

@konradpabjan
Copy link
Collaborator

Done! 😃

I've created a new release and updated the v2 tag so you can use the new features with actions/upload-artifact@v2

https://github.com/actions/upload-artifact#upload-using-multiple-paths-and-exclusions

@eine
Copy link

eine commented Jul 10, 2020

@konradpabjan thanks! It works nice!

Regarding #55 (comment) (i.e. uploading multiple paths with different names in a single call to the action), shall I open a new issue?

@konradpabjan
Copy link
Collaborator

@eine To be frank, given that we can only accept input via key value pairs, doing something with multiple name and path inputs seems impossible right now 🤔 We're just too limited with the YAML. The title part in your example for sure is not possible.

If we had support for list inputs with actions/toolkit#184, maybe we could do something like

- uses: actions/upload-artifact@v2
  with:
      name:
         - artifact1
         - artifact2
       path:
         - [ path/to/rpms/*.rpm,  path/to/debs/*.deb ]
         - [ "README.md", path/to/docs, !path/to/docs/tmp ]

but I'm not too big of a fan of this. I think it would be simpler for users to just call actions/artifact@v2 multiple times.

@eine
Copy link

eine commented Jul 10, 2020

@konradpabjan I'd propose some other syntax that works around the key-value limitation. For example (removing the need for name):

- uses: actions/upload-artifact@v2
  with:
       path: |
         artifact1: path/to/my_artifact.tar.gz
         artifact2: path/to/rpms/*.rpm,  path/to/debs/*.deb
         artifact3: "README.md", path/to/docs, !path/to/docs/tmp
         "artifact:subname": path/to/another.tar.gz

Although I understand that calling the action multiple times is an acceptable workaround given the constraints, I think that the UX should not be deteriorated because of incomplete implementations. Of course, it would make sense to delay such change to v3.

@kenorb
Copy link

kenorb commented Oct 15, 2020

Doesn't seems to work when uploading files from the different directories. E.g.

        uses: actions/upload-artifact@v2
        with:
          name: files
          path: |
            '*.ex?'
            '_optimize/*.set'

Issue:

Run actions/upload-artifact@v2
  with:
    name: files
    path: '*.ex?'
  '_optimize/*.set'
  
    if-no-files-found: warn
Warning: No files were found with the provided path: '*.ex?'
'_optimize/*.set'. No artifacts will be uploaded.

@rdcm
Copy link

rdcm commented Jul 20, 2021

Finally, which wildcard syntax could I use for multiple packages upload?

I have multiple NuGet packages in several directories, and I do not want to explicitly specify the path for each packet.

Current workflow yml:

- name: Upload Nuget packages
        uses: actions/upload-artifact@v2
        with:
          name: NugetPackages
          if-no-files-found: error
          path: ./**/*.nupkg

@EdwinFairchild
Copy link

so 2022 came and went any update on this?

@iocmet
Copy link

iocmet commented Jul 1, 2023

Hi, can i upload all files from two folder into root of result artifact?
- name: Upload jar
uses: actions/upload-artifact@v3
with:
name: Build
path: |
Server/build/libs/*
Client/build/libs/*
Results Build.zip like: Server/build/libs/file-server.jar and Client/build/libs/file-client.jar but i need file-server.jar and file-client.jar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

14 participants