[英]Upload a github action artifact to LATEST release
I want to upload a artifact to latest release... without creating a new release.我想将工件上传到最新版本...而不创建新版本。
I started with github official action upload-release-asset to upload artifact.我从github官方动作upload-release-asset开始上传神器。
It requires a upload_url as an input which tells it the url of release.它需要一个upload_url作为输入,告诉它发布的 url。
Which is generally taken from creating a release in previous step with create-release action.这通常取自在上一步中使用create-release操作创建发布。
I tried to print output url from create_release-我试图从 create_release- 打印 output url
https://uploads.github.com/repos/atiqg/test/releases/28579698/assets{?name,label}
Then I changed it to direct to latest release-然后我将其更改为直接到最新版本-
https://uploads.github.com/repos/atiqg/test/releases/latest/assets
Which oblivously did not work out and thrown this error-不知不觉没有解决并抛出这个错误 -
##[error]Multipart form data required
Is there any way I can do this?有什么办法可以做到这一点吗? I don't want to create a new release from actions.我不想从操作中创建新版本。
I want to create release normally then action should upload artifact to latest release...我想正常创建发布,然后操作应该将工件上传到最新版本...
If latest
doesn't work, you can use GitHub API to get upload_url
...如果latest
的不起作用,您可以使用 GitHub API 来获取upload_url
...
https://api.github.com/repos/actions/checkout/releases/latest https://api.github.com/repos/actions/checkout/releases/latest
...and then pass it to upload-release-asset
. ...然后将其传递给upload-release-asset
。
In workflow it would look something like this在工作流程中,它看起来像这样
- run: |
upload_url=$(curl -sL https://api.github.com/repos/actions/checkout/releases/latest | jq -r '.upload_url')
echo UPLOAD_URL=$upload_url >> $GITHUB_ENV
shell: bash
- uses: actions/upload-release-asset@v1
with:
upload_url: ${{ env.UPLOAD_URL }}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.