简体   繁体   中英

Upload file with GitHub action instead of folder

I use actions/upload-artifact to upload artifacts after a successful workflow run like this:

   path: |
     path/to/firstbin.app
     path/to/secondbin.dmg

The binaries are stored in bundle/app/firstbin.app and bundle/dmg/secondbin.dmg . GHA uploads the bundle folder. So I get a useless folder in the artifact file. How to upload only these two files?

The documentation clearly states that "if multiple paths are provided as input, the least common ancestor of all the search paths will be used as the root directory of the artifact." Therefore, you need to either avoid specifying multiple paths or copy the files to a flattened staging directory.

You can upload two files to the same artifact like this:

      - uses: actions/upload-artifact@v3
        with:
         name: first/abc/firstbin.app
         path: 
         if-no-files-found: error
      - uses: actions/upload-artifact@v3
        with:
         name: second/xyz/firstbin.dmg
         path: 
         if-no-files-found: error

Be careful when uploading to the same artifact and read the relevant documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM