Modernize release workflow: gh-release v3, skip redundant builds, and update existing releases safely#2
Merged
Conversation
Agent-Logs-Url: https://github.com/techlogycs/rust-browser-handler/sessions/5091d01c-27ad-4b0e-8a3f-6f9ec0740785 Co-authored-by: axellpadilla <68310020+axellpadilla@users.noreply.github.com>
Agent-Logs-Url: https://github.com/techlogycs/rust-browser-handler/sessions/5091d01c-27ad-4b0e-8a3f-6f9ec0740785 Co-authored-by: axellpadilla <68310020+axellpadilla@users.noreply.github.com>
Agent-Logs-Url: https://github.com/techlogycs/rust-browser-handler/sessions/5091d01c-27ad-4b0e-8a3f-6f9ec0740785 Co-authored-by: axellpadilla <68310020+axellpadilla@users.noreply.github.com>
Agent-Logs-Url: https://github.com/techlogycs/rust-browser-handler/sessions/5091d01c-27ad-4b0e-8a3f-6f9ec0740785 Co-authored-by: axellpadilla <68310020+axellpadilla@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
axellpadilla
May 9, 2026 08:38
View session
Contributor
Reviewer's GuideRefactors the release GitHub Actions workflow to introduce a preparatory release-state detection job, conditionally skip unnecessary builds when release assets already exist, and make the release job idempotent and upgradable via softprops/action-gh-release v3 with consistent metadata handling. Sequence diagram for idempotent release on workflow_dispatch rerunsequenceDiagram
actor Dev as Developer
participant GA as GitHubActions
participant Prepare as Job_prepare
participant GHAPI as GitHubReleasesAPI
participant Build as Job_build
participant Release as Job_release
participant GHRel as softprops_action_gh_release_v3
Dev->>GA: Trigger workflow_dispatch (version input)
GA->>Prepare: Start job prepare
Prepare->>Prepare: Derive tag/version from input
Prepare->>GHAPI: GET /repos/{repo}/releases/tags/{tag}
GHAPI-->>Prepare: 200 OK with release JSON (assets complete)
Prepare->>Prepare: Compute should_build = false
Prepare-->>GA: Outputs tag, version, should_build=false
GA->>Build: Evaluate condition needs.prepare.outputs.should_build == 'true'
Build-->>GA: Condition false, job skipped
GA->>Release: Start job release
Release->>Release: Check needs.prepare.result == success
Release->>Release: Check needs.build.result in {success, skipped}
alt workflow_dispatch
Release->>Release: Ensure tag exists (git tag / push)
end
Release->>Release: Set RELEASE_BODY env (shared metadata)
opt should_build == false (metadata-only path)
Release->>GHRel: Run action-gh-release v3
activate GHRel
GHRel->>GHAPI: Update release metadata\n(overwrite_files: true, no new assets)
GHAPI-->>GHRel: 200 OK
deactivate GHRel
end
Release-->>GA: Job complete (idempotent update)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/release.yml" line_range="35-38" />
<code_context>
+ set -euo pipefail
+ release_json_path="${RUNNER_TEMP}/release.json"
+
+ if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
+ version='${{ github.event.inputs.version }}'
+ tag="v${version}"
+ else
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Guard against empty or malformed `version` when triggered via `workflow_dispatch`.
In the `workflow_dispatch` case we assume `github.event.inputs.version` is non-empty and valid. If it’s missing or not semver-like, we’ll still build `tag="v"` (or another invalid tag) and continue. Please add basic validation (non-empty + simple semver check) and fail fast (`exit 1` with a clear message) when the input is invalid to avoid creating bad tags.
```suggestion
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
version='${{ github.event.inputs.version }}'
if [[ -z "${version}" ]]; then
echo "Error: version input is required when triggering via workflow_dispatch." >&2
exit 1
fi
if ! [[ "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z]+)*$ ]]; then
echo "Error: invalid version '${version}' provided via workflow_dispatch; expected semver-like value (e.g. 1.2.3 or 1.2.3-beta.1)." >&2
exit 1
fi
tag="v${version}"
else
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Collaborator
|
@copilot fix Invalid workflow file: .github/workflows/release.yml#L65 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the release pipeline to use the latest
softprops/action-gh-releaseand removes unnecessary rebuilds when release assets already exist. It also makes reruns idempotent by updating existing releases instead of failing or duplicating work.Release action upgrade
softprops/action-gh-release@v1.10.0to@v3.Preflight release state detection
preparejob that resolvestag/versionand queries the GitHub Releases API.rust_browser_handler_windows.zip,rust_browser_handler_linux.tar.gz) and emitsshould_build.Conditional build execution
buildnow runs only when required assets are missing.Idempotent release publishing
releasejob now handles both paths:overwrite_files: trueto ensure existing releases are updated predictably on reruns.Workflow reliability/readability
${RUNNER_TEMP}for temporary API response files.!cancelled()+ explicitneedsresult checks).Summary by Sourcery
Modernize the GitHub release workflow to be idempotent, reuse existing artifacts when possible, and safely create or update releases with the latest gh-release action.
Enhancements: