0

I have a docker container that is being built in a github action. It then copies out a blah.tgz and blah.iso from /export inside the container. I would like to upload both artifacts as a GitHub release. Here is the github action:

name: build
on:
  push:
    branches:
    - main
jobs:
  extract_images_from_docker_build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Login to GitHub Container Registry
      uses: docker/login-action@v2
      with:
        registry: ghcr.io
        username: ${{ github.repository_owner }}
        password: ${{ secrets.GHCR_PAT }}
    - name: Build the Docker image
      run: docker build -t ghcr.io/image/build:latest -f docker/Dockerfile .
    - uses: shrink/actions-docker-extract@v2
      id: extract
      with:
        image: ghcr.io/image/build:latest
        path: /export/.
    - name: Create Release
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GHCR_PAT }}
      with:
        tag_name: ${{ github.ref }}
        release_name: Release ${{ github.ref }}
        body: |
          Changes in this Release
          - Initial alpha release
        draft: true
        prerelease: true
    - name: Upload Release Asset
      id: upload-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: ${{ steps.extract.outputs.destination }}
        asset_name: ${{ steps.extract.outputs.destination }}
        asset_content_type: application/zip

However I get this error:

Run actions/upload-release-asset@v1
  with:
    upload_url: https://uploads.github.com/repos/blah/blah/releases/97404561/assets{?name,label}
    asset_path: .extracted-1680133372939
    asset_name: .extracted-1680133372939
    asset_content_type: application/zip
  env:
    GITHUB_TOKEN: ***
  
Error: EISDIR: illegal operation on a directory, read
maskeda
  • 183
  • 1
  • 10

1 Answers1

1

The output parameter destination of shrink/actions-docker-extract contains the directory that contains the file(s):

destination | Destination path containing the extracted file(s) | .extracted-1598717412/

And, the asset_path of actions/upload-release-asset is pointing to that in this line:

asset_path: ${{ steps.extract.outputs.destination }}

But, it is looking for a .zip file, hence the EISDIR error.

You need to configure asset_path and asset_name part accordingly.

You may verify the extracted file in a separate step with ls and make sure that it's format is what you're trying to upload.

Azeem
  • 11,148
  • 4
  • 27
  • 40