简体   繁体   English

GitHub Actions download-artifact 是否创建存档或文件夹结构?

[英]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.我正在使用 GitHub Actions 并有 2 个作业,一个上传文件夹,另一个将使用该文件夹创建图像。

Job 1:工作 1:

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

Job 2:工作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?这会添加存档 (zip/tar/tar.gz) 还是会重新创建文件夹结构? I have looked at the documentation but i couldn't find a place where it was made clear.我查看了文档,但找不到明确说明的地方。

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.我对其进行了测试,如果您上传一个文件夹,然后使用 GitHub Actions 再次下载它,它会重新创建以给定路径为基础上传的原始结构。

But it does not recreate the parent folder as documented here: GitHub Actions: Changes to artifact download experience .但它不会按照此处所述重新创建父文件夹: GitHub 操作:工件下载体验的更改

It does not, as i was worrying about, download the artifact as an archive.它不会像我担心的那样将工件下载为存档。

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.您可以在此处的文档中看到一个示例,其中显示download-artifact将存档解压缩回其原始目录结构。

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:这是示例工作流的相关部分,它下载homework工件,并且math-homework.txt已解压缩并可在下一步中访问:

    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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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