Skip to content

fix: enhance draft release handling in publish workflow#1451

Merged
shm11C3 merged 2 commits into
developfrom
fix/public-action
May 4, 2026
Merged

fix: enhance draft release handling in publish workflow#1451
shm11C3 merged 2 commits into
developfrom
fix/public-action

Conversation

@shm11C3

@shm11C3 shm11C3 commented May 4, 2026

Copy link
Copy Markdown
Owner

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

  • Bug fix (fix/ branch)

Screenshots / Videos

Test Plan

  • Manual testing
  • Unit tests

Checklist

  • Self-reviewed the code
  • Linting and formatting pass (npm run lint && npm run format / cargo tauri-lint && cargo tauri-fmt)
  • Tests pass (npm test / cargo tauri-test)
  • No new warnings or errors

Summary by CodeRabbit

  • Chores
    • Improved release automation: publishes are now serialized per tag to avoid concurrent conflicts.
    • Workflow auto-creates draft releases (with prerelease set for dashed versions) when needed and links release creation to the publish step.
    • Release asset uploads now safely overwrite existing files to ensure the latest artifacts are attached.

Copilot AI review requested due to automatic review settings May 4, 2026 18:55
@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Extracts release creation into a new prepare-release job in the publish workflow that checks for or creates a draft GitHub release for the current tag (setting prerelease when tag contains -), exposes release-id, and wires publish-tauri and artifact uploads to use that release ID.

Changes

Release Workflow Preparation

Layer / File(s) Summary
Workflow concurrency
.github/workflows/publish.yml
Adds top-level concurrency keyed by tag name with cancel-in-progress: false.
Release Preparation Job
.github/workflows/publish.yml
Introduces prepare-release job (runs only on tag refs) that queries gh api for an existing release, creates a draft with generate_release_notes=true and prerelease set when tag contains -, and outputs release-id.
Job Dependency Wiring
.github/workflows/publish.yml
publish-tauri now declares needs: prepare-release to depend on the new job.
Tauri Action Configuration
.github/workflows/publish.yml
Updates tauri-apps/tauri-action inputs to pass releaseId: ${{ needs.prepare-release.outputs.release-id }} and removes releaseName, releaseDraft, and prerelease inputs.
Artifact Uploads
.github/workflows/publish.yml
Changes gh release upload calls for offline MSI and per-platform THIRD_PARTY_NOTICES.md to include --clobber so uploads overwrite existing assets for the same release.
Tests / Docs
(none)
No code tests or documentation files were changed.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through jobs and tags tonight,
I checked for releases, made drafts just right.
Outputs shared, uploads clobbered with care,
CI hums steady — the pipeline's aware. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enhancing draft release handling in the publish workflow, which matches the primary objective of creating/finding draft releases.
Description check ✅ Passed The description covers the required sections with a clear summary and marked bug fix type. However, no related issues are linked (required for new features, not critical for bug fixes), and most checklist items remain unchecked, indicating incomplete validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/public-action

Review rate limit: 3/5 reviews remaining, refill in 22 minutes and 43 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added bug Something isn't working github_actions Pull requests that update GitHub Actions code labels May 4, 2026
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 97.28% (🎯 60%) 1182 / 1215
🔵 Statements 96.81% (🎯 60%) 1246 / 1287
🔵 Functions 96.74% (🎯 60%) 297 / 307
🔵 Branches 90.54% (🎯 60%) 431 / 476
File CoverageNo changed files found.
Generated in workflow #2904 for commit de94329 by the Vitest Coverage Report Action

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6653f7a and 779385e.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml

Comment thread .github/workflows/publish.yml
Comment thread .github/workflows/publish.yml Outdated
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

Rust Tauri Coverage Report

Coverage Details
Filename                                     Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
_tests/commands/background_image_test.rs          39                 0   100.00%           6                 0   100.00%          21                 0   100.00%           0                 0         -
_tests/commands/settings_test.rs                 219                 0   100.00%          18                 0   100.00%         162                 0   100.00%           0                 0         -
adapters/tray.rs                                 152               152     0.00%          15                15     0.00%         104               104     0.00%           0                 0         -
adapters/window.rs                               254                69    72.83%          21                 8    61.90%         195                47    75.90%           0                 0         -
app/startup.rs                                   188                87    53.72%          10                 3    70.00%         114                58    49.12%           0                 0         -
commands/background_image.rs                      22                 7    68.18%          11                 5    54.55%          19                 7    63.16%           0                 0         -
commands/hardware.rs                              62                62     0.00%          20                20     0.00%          68                68     0.00%           0                 0         -
commands/settings.rs                             578               578     0.00%         102               102     0.00%         497               497     0.00%           0                 0         -
commands/system.rs                                21                21     0.00%          10                10     0.00%          20                20     0.00%           0                 0         -
commands/ui.rs                                    17                17     0.00%           2                 2     0.00%          13                13     0.00%           0                 0         -
commands/updater.rs                               97                97     0.00%          15                15     0.00%          66                66     0.00%           0                 0         -
enums/error.rs                                   115                10    91.30%           9                 1    88.89%          99                10    89.90%           0                 0         -
enums/hardware.rs                                194                 7    96.39%          16                 1    93.75%         120                 6    95.00%           0                 0         -
enums/settings.rs                                425                16    96.24%          26                 2    92.31%         289                10    96.54%           0                 0         -
infrastructure/database/migration.rs              66                 1    98.48%          10                 0   100.00%          86                 0   100.00%           0                 0         -
lib.rs                                           216               216     0.00%           5                 5     0.00%         138               138     0.00%           0                 0         -
lifecycle.rs                                     227               178    21.59%          29                25    13.79%         160               137    14.37%           0                 0         -
main.rs                                            3                 3     0.00%           1                 1     0.00%           3                 3     0.00%           0                 0         -
models/hardware.rs                               375                83    77.87%          31                12    61.29%         275               100    63.64%           0                 0         -
models/hardware_archive.rs                         8                 0   100.00%           2                 0   100.00%          10                 0   100.00%           0                 0         -
models/settings.rs                               283                 0   100.00%          16                 0   100.00%         246                 0   100.00%           0                 0         -
services/background_image_service.rs             165                96    41.82%          16                10    37.50%          93                59    36.56%           0                 0         -
services/gpu_service.rs                           56                56     0.00%          11                11     0.00%          43                43     0.00%           0                 0         -
services/hardware_service.rs                      85                85     0.00%           4                 4     0.00%          51                51     0.00%           0                 0         -
services/language_service.rs                     101                 0   100.00%          18                 0   100.00%          57                 0   100.00%           0                 0         -
services/memory_service.rs                        12                12     0.00%           3                 3     0.00%           7                 7     0.00%           0                 0         -
services/motherboard_service.rs                   12                12     0.00%           3                 3     0.00%           7                 7     0.00%           0                 0         -
services/network_service.rs                       14                14     0.00%           1                 1     0.00%           8                 8     0.00%           0                 0         -
services/settings_service.rs                     321               143    55.45%          31                13    58.06%         269               130    51.67%           0                 0         -
services/system_service.rs                        22                22     0.00%           2                 2     0.00%          12                12     0.00%           0                 0         -
services/ui_service.rs                            45                45     0.00%           8                 8     0.00%          36                36     0.00%           0                 0         -
tray/surface/mod.rs                                8                 8     0.00%           2                 2     0.00%           5                 5     0.00%           0                 0         -
tray/surface/tauri_surface.rs                     80                80     0.00%           6                 6     0.00%          48                48     0.00%           0                 0         -
tray/widget.rs                                   562                28    95.02%          50                 3    94.00%         505                26    94.85%           0                 0         -
utils/color.rs                                    66                 1    98.48%           4                 0   100.00%          26                 0   100.00%           0                 0         -
utils/file.rs                                    224                 5    97.77%          14                 0   100.00%         144                 4    97.22%           0                 0         -
utils/formatter.rs                                55                 0   100.00%           5                 0   100.00%          39                 0   100.00%           0                 0         -
utils/logger.rs                                   71                71     0.00%           1                 1     0.00%          38                38     0.00%           0                 0         -
utils/tauri.rs                                   138                 0   100.00%          17                 0   100.00%          82                 0   100.00%           0                 0         -
workers/mod.rs                                    40                40     0.00%           2                 2     0.00%          24                24     0.00%           0                 0         -
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                           5638              2322    58.82%         573               296    48.34%        4199              1782    57.56%           0                 0         -

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-release job that looks up an existing draft release by tag or creates one via gh api.
  • Wired publish-tauri to depend on that job and pass the resolved releaseId into tauri-action.
  • Removed the previous inline release creation flags from the Tauri action step in favor of the pre-created draft release.

Comment thread .github/workflows/publish.yml Outdated
Comment thread .github/workflows/publish.yml
Comment thread .github/workflows/publish.yml Outdated
@shm11C3 shm11C3 enabled auto-merge (squash) May 4, 2026 19:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 779385e and de94329.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml

Comment thread .github/workflows/publish.yml
@shm11C3 shm11C3 merged commit 8880cda into develop May 4, 2026
41 checks passed
@shm11C3 shm11C3 deleted the fix/public-action branch May 4, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants