is multiple paths supported?
Can anyone comment on if this is currently possible?
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: https://github.com/actions/toolkit/issues/184
While we wait for official support, we can use a hack (similar to what @actions/cache has done) to support multiple path inputs: https://github.com/actions/cache/issues/44
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
What will also be nice is to specify glob patterns too. So something like:
path:
- /releases/**/*.apk
Now that #3 is published (:tada:), I guess this is the main remaining feature requested/proposed in https://github.com/actions/upload-artifact/issues/3#issuecomment-524442814:
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 ]
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.
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: https://github.com/actions/upload-artifact/blob/97b7dace6c8d860ce9708aba808be6a2ee4cbc3a/src/search.ts#L46
can we do this yet or not?
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
paths:
- 1
- 2
- 3
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!
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
@konradpabjan thanks! It works nice!
Regarding https://github.com/actions/upload-artifact/issues/55#issuecomment-620799602 (i.e. uploading multiple paths with different names in a single call to the action), shall I open a new issue?
@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 https://github.com/actions/toolkit/issues/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.
@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.
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.
Most helpful comment
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: