Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

upload artifact in GitHub Action

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 }}
like image 228
user989988 Avatar asked May 28 '26 14:05

user989988


1 Answers

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

like image 54
Itay Brenner Avatar answered Jun 02 '26 22:06

Itay Brenner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!