upload artifact in GitHub Action

∥☆過路亽.° 提交于 2020-12-15 08:34:20

问题


How do I update the following code so that artifact contains a folder named 'Scripts' and all the files are copied to 'Scripts' folder?

 - 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:


You can use this:

 - 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 }}

Just create a folder between your artifact and your desired files



来源:https://stackoverflow.com/questions/64037059/upload-artifact-in-github-action

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!