在GitHub Action中上载工件

时间:2020-09-23 22:21:33

标签: github github-actions

如何更新以下代码,以使工件包含名为“脚本”的文件夹,并将所有文件复制到“脚本”文件夹?

 - name: copy scripts
      run: Copy 'Scripts/' '${{ github.workspace }}/Scripts'
      shell: powershell

- name: publish artifact
      uses: actions/upload-artifact@v2
      with:
        path: ${{ github.workspace }}/Scripts
        name: ${{ github.run_number }}

1 个答案:

答案 0 :(得分:0)

您可以使用此:

 - name: Create Artifact Folder
   run: New-Item -Path '${{ github.workspace }}' -Name "Artifacts" -ItemType "directory"
   shell: powershell
 - name: Copy Scripts
   run: Copy 'Scripts/' '${{ github.workspace }}/Artifacts/Scripts'
   shell: powershell
 - name: Publish Artifact
   uses: actions/upload-artifact@v2
   with:
     path: ${{ github.workspace }}/Artifacts
     name: ${{ github.run_number }}

只需在您的工件和所需文件之间创建一个文件夹