fix: enhance draft release handling in publish workflow#1451
Conversation
📝 WalkthroughWalkthroughExtracts release creation into a new ChangesRelease Workflow Preparation
Sequence Diagram(s)sequenceDiagram
opt Colors
participant Runner as Runner
participant GHAPI as GitHub API
participant TauriAction as tauri-apps/tauri-action
participant GHRelease as gh release (uploader)
end
Runner->>GHAPI: GET /repos/:owner/:repo/releases/tags/:tag
alt release exists
GHAPI-->>Runner: 200 + release JSON (id)
else release missing
Runner->>GHAPI: POST /repos/:owner/:repo/releases {draft:true, prerelease:bool, generate_release_notes:true}
GHAPI-->>Runner: 201 + release JSON (id)
end
Runner->>TauriAction: run with releaseId
TauriAction-->>Runner: build artifacts
Runner->>GHRelease: gh release upload --clobber <artifacts> --release-id
GHRelease-->>Runner: 200 OK
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 3/5 reviews remaining, refill in 22 minutes and 43 seconds. Comment |
Coverage Report
File CoverageNo changed files found. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/publish.yml:
- Around line 34-49: The lookup for an existing release uses a jq filter that
includes ".draft == true", which causes published releases with the same tag to
be ignored; update the gh api query that assigns draft_release_id (the jq
expression used on the "repos/${GITHUB_REPOSITORY}/releases" call) to remove the
".draft == true" condition so it matches any release with the given release_tag,
and if you still need draft-specific logic, fetch by tag first (using the same
gh api call result) and then inspect the resulting object's "draft" field to
decide further actions.
- Around line 24-27: Guard the release creation step so it only runs for tag
refs: check GITHUB_REF_TYPE (not just GITHUB_REF_NAME) and bail out early unless
it equals "tag". Specifically, before you set or use release_tag, add a
conditional that verifies GITHUB_REF_TYPE == "tag" (or exits/returns early when
it's not a tag) so release_tag is only derived from GITHUB_REF_NAME for true tag
events; refer to the release_tag variable and the environment variables
GITHUB_REF_NAME and GITHUB_REF_TYPE when implementing this guard.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 78801638-dc87-4e0c-b340-57acc79cb575
📒 Files selected for processing (1)
.github/workflows/publish.yml
Rust Tauri Coverage ReportCoverage Details |
There was a problem hiding this comment.
Pull request overview
This PR updates the publish workflow so release creation is handled explicitly before the Tauri build matrix runs, with the goal of reusing a draft release for a tag instead of letting each publish path create its own release state.
Changes:
- Added a new
prepare-releasejob that looks up an existing draft release by tag or creates one viagh api. - Wired
publish-taurito depend on that job and pass the resolvedreleaseIdintotauri-action. - Removed the previous inline release creation flags from the Tauri action step in favor of the pre-created draft release.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/publish.yml:
- Around line 20-21: The workflow only exposes release-id from the
prepare-release step but not the release's draft state, so tauri-action defaults
to releaseDraft:false; update the prepare-release step that sets outputs
(currently using steps.release.outputs.release_id) to also capture and expose
the release draft flag (e.g., add an output like release-draft: ${{
steps.release.outputs.draft }} or the actual output name provided by the
prepare-release action), then update the tauri-action step to pass that output
into its releaseDraft input (e.g., set releaseDraft: ${{
needs.prepare-release.outputs.release-draft }} or the equivalent job/step output
reference) so the tauri-action releaseDraft matches the real draft state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 9320a9c2-86d1-42a8-9e97-f38c17009ea7
📒 Files selected for processing (1)
.github/workflows/publish.yml
Summary
Enhance the publish workflow to improve handling of draft releases by creating or finding existing draft releases based on the release tag.
Related Issues
Type of Change
fix/branch)Screenshots / Videos
Test Plan
Checklist
npm run lint && npm run format/cargo tauri-lint && cargo tauri-fmt)npm test/cargo tauri-test)Summary by CodeRabbit