goreleaser / goreleaser

Deliver Go binaries as fast and easily as possible

Home Page:https://goreleaser.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for `--draft` flag in `goreleaser release` command

DeadNews opened this issue · comments

Is your feature request related to a problem? Please describe.

I'm trying to conditionally create a draft release with GoReleaser in my GitHub workflow. I tried using the --draft flag with the goreleaser release command, but I got an unknown flag: --draft error message. This prevents me from creating draft releases conditionally based on the tag name (e.g. alpha, beta).

Here's the GitHub workflow example:

goreleaser:
  name: GoReleaser
  if: github.ref_type == 'tag'
  needs: [lint, check-deps, tests]
  environment: github-releases
  permissions:
    contents: write
  env:
    DRAFT: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0

    - uses: actions/setup-go@v5
      with:
        go-version: stable

    - name: Run GoReleaser
      uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
      with:
        version: latest
        args: release --clean --draft ${{ env.DRAFT }}
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

As I understand it, the only way to create a draft release now is to set the draft field to true in the .goreleaser.yml file.

Describe the solution you'd like

I would like the --draft flag to be recognized by the goreleaser release command.

Describe alternatives you've considered

Search

  • I did search for other open and closed issues before opening this

Supporter

Code of Conduct

  • I agree to follow this project's Code of Conduct