Does GitHub Actions download-artifact create an archive or folder structure?
Asked Answered
I

2

5

I am using GitHub Actions and have 2 jobs, one that uploads a folder, and another that will create an image using that folder.

Job 1:

- name: Upload Build
  uses: actions/upload-artifact@v1
    with:
      name: StandaloneLinux64
      path: build/StandaloneLinux64

Job 2:

- uses: actions/download-artifact@v1
  with:
    name: StandaloneLinux64
    path: Docker/StandaloneLinux64

Will this add an archive (zip/tar/tar.gz) or will this recreate the folder structure? I have looked at the documentation but i couldn't find a place where it was made clear.

Intermezzo answered 4/2, 2020 at 14:22 Comment(2)
Why not try it? If the docs didn't state it will be archived, it probably wont be archived.Martyrology
@Martyrology the work flow is a lot more complicated with forks, and secrets. Also, so if I don't get an answer I can test it and answer it for others.Intermezzo
I
8

I tested it and if you upload a folder and then download it again using GitHub Actions, it recreates the original structure that was uploaded with the given path as the base.

But it does not recreate the parent folder as documented here: GitHub Actions: Changes to artifact download experience.

It does not, as i was worrying about, download the artifact as an archive.

Intermezzo answered 5/2, 2020 at 13:43 Comment(1)
To preserve the same behavior as v1, set path to the name fo the destination folderPokeberry
T
1

You can see an example in the documentation here, where it shows that download-artifact unpacks the archive back into it's original directory structure.

This is the relevant part of the example workflow where it downloads the homework artifact and math-homework.txt is already unpacked and accessible in the next step:

    steps:
      - name: Download math result for job 1
        uses: actions/download-artifact@v1
        with:
          name: homework
      - shell: bash
        run: |
          value=`cat homework/math-homework.txt`
          expr $value \* 9 > homework/math-homework.txt
Tennessee answered 5/2, 2020 at 13:26 Comment(1)
In the example they upload a file, math-homework.txt not a folder. Which was my question, what would happen if a folder, not a file was up/downloaded. But i found it out by testing.Intermezzo

© 2022 - 2024 — McMap. All rights reserved.