GitHub动作上传docker工件作为发布



我有一个docker容器正在构建在github的行动。然后它会复制出一串废话。TGZ什么的。从/export容器内的Iso文件。我想上传这两个工件作为GitHub发布。下面是github的操作:

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

但是我得到这个错误:

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

收缩/动作-docker-extract的输出参数destination包含文件所在的目录:

destination|包含解压文件的目标路径|.extracted-1598717412/

并且,actions/upload-release-asset的asset_path指向这一行:

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

但是,它正在寻找一个.zip文件,因此EISDIR错误。

需要相应配置asset_pathasset_name部分。

你可以用ls在单独的步骤中验证提取的文件,并确保它的格式是你想要上传的。

相关内容

  • 没有找到相关文章

最新更新