Redline
Redline

Reputation: 581

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

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.

Upvotes: 7

Views: 9827

Answers (2)

Redline
Redline

Reputation: 581

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.

Upvotes: 10

peterevans
peterevans

Reputation: 41930

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

Upvotes: 1

Related Questions