actions / upload-release-asset

An Action to upload a release asset via the GitHub Release API
MIT License
683 stars 187 forks source link

EISDIR: illegal operation on a directory, read #35

Closed Arjan-Zuidema closed 4 years ago

Arjan-Zuidema commented 4 years ago

I have a workflow that build two versions of an application. One for Windows and one for MacOS. These builds run in parallel. When finished a new job is spawned to create a GitHub release ad publish the files to that release.

I am using actions/download-artifact@v1 to download the artifacts from the previous jobs. When trying to upload the files to the release I get an error: EISDIR: illegal operation on a directory, read. See log of the actions/upload-release-asset step below:

Run actions/upload-release-asset@v1
  with:
    upload_url: https://uploads.github.com/repos/MyAlbum/Sketch2Blueprint/releases/24428353/assets{?name,label}
    asset_path: /home/runner/work/_temp/latest-mac.yml
    asset_name: latest-mac.yml
    asset_content_type: text/yaml
  env:
    GITHUB_TOKEN: ***
##[error]EISDIR: illegal operation on a directory, read
Margen67 commented 4 years ago

@Arjan-Zuidema Are you sure it's not a directory?

Arjan-Zuidema commented 4 years ago

The files are downloaded using actions/download-artifact@v1 with the exact same paths, so how can it be a directory? Maybe it's a bug in actions/download-artifact@v1 but I don't know.

the-mikedavis commented 4 years ago

@Arjan-Zuidema I just ran into this as well. You probably want to download-artifact into your current directory. download-artifact will unzip your artifact into a directory given as the path argument

    - name: Upload the artifact
      uses: actions/upload-artifact@v1
      with:
        name: my-artifact
        path: path/to/my/artifact.tar.gz

# ... next job or whenever you need the artifact

    - name: Download the artifact
      uses: actions/download-artifact@v1
      with:
        name: my-artifact
        path: ./

    - name: Upload the release asset
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}
        asset_path: artifact.tar.gz
        asset_name: artifact.tar.gz
        asset_content_type: application/gzip
Arjan-Zuidema commented 4 years ago

@Arjan-Zuidema I just ran into this as well. You probably want to download-artifact into your current directory. download-artifact will unzip your artifact into a directory given as the path argument

    - name: Upload the artifact
      uses: actions/upload-artifact@v1
      with:
        name: my-artifact
        path: path/to/my/artifact.tar.gz

# ... next job or whenever you need the artifact

    - name: Download the artifact
      uses: actions/download-artifact@v1
      with:
        name: my-artifact
        path: ./

    - name: Upload the release asset
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}
        asset_path: artifact.tar.gz
        asset_name: artifact.tar.gz
        asset_content_type: application/gzip

Will look into it. Thanks! 🙂

Arjan-Zuidema commented 4 years ago

Setting path to the directory seems to fix the problem. It was unclear to me it had to be a directory and not a file path.