taiki-e / create-gh-release-action

GitHub Action for creating GitHub Releases based on changelog.
Apache License 2.0
72 stars 11 forks source link

Promoting draft release #25

Open aymericbeaumet opened 1 year ago

aymericbeaumet commented 1 year ago

I'm trying to implement the following workflow:

  1. Create a draft release
  2. Build and publish to the registries
  3. Publish the release by promoting the draft as the final release

I've tried the following, but the draft release is overriden:

jobs:
  begin-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: taiki-e/create-gh-release-action@v1
        with:
          draft: true
          token: ${{ secrets.GITHUB_TOKEN }}

  # other jobs

  finish-release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: taiki-e/create-gh-release-action@v1
        with:
          draft: false
          token: ${{ secrets.GITHUB_TOKEN }}

Do you have any suggestion as to how to approach this draft -> publish promotion?

taiki-e commented 1 year ago

Currently, this action only supports creating a new release or overwriting an existing release (https://github.com/taiki-e/create-gh-release-action/issues/5), but I'm okay with adding support for updating an existing release.

That said, the following single command should probably be enough to do this:

- run: gh release edit "${GITHUB_REF#refs/tags/}" --draft=false
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

See also GitHub CLI docs.

aymericbeaumet commented 1 year ago

I've tried your solution with the GitHub CLI, and it worked like a charm. Thanks!

I think adding support for updating an existing release would make sense to keep things abstracted under the same GitHub actions. But I would not consider it a high priority.