最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Prevent GitHub release from being visible until workflow complete? - Stack Overflow

programmeradmin2浏览0评论

I've got a release workflow in GitHub that on release will do things like run localise, update version numbers in code, etc., and then create the release.zip file and add it to the release. The automation itself works great, but it does introduce a problem.

Since GitHub creates the release and publishes it, the release then does not have the release.zip file it needs for 3rd party services to pick up until the workflow is complete.

Is there a way to make it so a release won't actually be published until the workflow is complete?

I've got a release workflow in GitHub that on release will do things like run localise, update version numbers in code, etc., and then create the release.zip file and add it to the release. The automation itself works great, but it does introduce a problem.

Since GitHub creates the release and publishes it, the release then does not have the release.zip file it needs for 3rd party services to pick up until the workflow is complete.

Is there a way to make it so a release won't actually be published until the workflow is complete?

Share Improve this question edited yesterday jonrsharpe 122k30 gold badges266 silver badges473 bronze badges asked yesterday K20GHK20GH 6,27121 gold badges84 silver badges127 bronze badges 7
  • Use a draft release? – jonrsharpe Commented yesterday
  • I had considered that, however I'm not the only collaborator in my repo, and I don't believe its possible to restrict the ability to create published released? – K20GH Commented yesterday
  • Why does that matter? Please include all relevant context, including what you've already dismissed, in the question. – jonrsharpe Commented yesterday
  • Of course it matters? The context and answer to that is already in the question. > Since GitHub creates the release and publishes it, the release then does not have the release.zip file it needs for 3rd party services to pick up until the workflow is complete. – K20GH Commented yesterday
  • 1 Oh, wait a sec: your workflow is triggered by doing the release! I get it now. My publish workflow is triggered by a tag push (on: push: tags: - v[0-9]+.**) and creating the release happens in that workflow. – joanis Commented yesterday
 |  Show 2 more comments

1 Answer 1

Reset to default 0

My recommendation is to do the release in a workflow that is triggered by a tag push, rather than triggering the workflow from the release.

name: release
on:
  push:
    tags:
      - v[0-9]+.**
jobs:
  build_and_release:
    runs-on: ...
    steps:
      - <insert steps to build things, including release.zip>
      - name: Create Release
        uses: ncipollo/release-action@v1    
        with:
          artifacts: "release.zip"

I use ncipollo/release-action in my release workflows, but there are several other workflows out there to do the same thing.

发布评论

评论列表(0)

  1. 暂无评论