tauri-apps / tauri-action

Build your Web application as a Tauri binary for macOS, Linux and Windows
https://tauri.app
MIT License
890 stars 147 forks source link

`publish-to-autorelease.yml` example overwrites an existing published release #838

Open sneakypete81 opened 3 months ago

sneakypete81 commented 3 months ago

Steps to reproduce:

  1. Run a job with the publish-to-autorelease.yml example. This creates a draft release.
  2. Manually publish the release by browsing to it and clicking Publish Release.
  3. Make another commit to the repo.
  4. Run the job again without updating the app version.

Expected:

The job should fail, since there is already a published release with the same tag.

Actual:

The published release's binaries are overwritten. However the release's tag isn't updated, so it is now pointing to the commit from first job run, not the one used to generate the new binaries. The source code archive is also from the original job commit, not the one used to generate the new binaries.

sneakypete81 commented 3 months ago

Related: the log at https://github.com/tauri-apps/tauri-action/blob/dev/src/create-release.ts#L65 says Looking for a draft release with tag ${tagName}... but the next line actually queries all releases, not just draft releases.

I think the if (draft) { logic here should differentiate between existing draft releases and published releases. If a published release is found with the same tag, the job should fail.