Skip to content

Implement beta publishing on development branch#85

Open
VikramGoyal23 wants to merge 11 commits intogit-mastery:mainfrom
VikramGoyal23:beta-publishing
Open

Implement beta publishing on development branch#85
VikramGoyal23 wants to merge 11 commits intogit-mastery:mainfrom
VikramGoyal23:beta-publishing

Conversation

@VikramGoyal23
Copy link
Copy Markdown
Contributor

Should be merged after the actions PR and after gitmastery-beta is registered on AUR and Winget.

RFC: https://docs.google.com/document/d/17ZhVua_eH_mWQIDc90ojq6EkiolRXQa5asBBvZhgfAU/edit?tab=t.0

@VikramGoyal23 VikramGoyal23 requested a review from jiaxinnns March 23, 2026 19:13
@VikramGoyal23 VikramGoyal23 marked this pull request as draft March 23, 2026 19:17
@jovnc
Copy link
Copy Markdown
Collaborator

jovnc commented Apr 11, 2026

@VikramGoyal23 Can we check on status of this? Hopefully we can get this merged soon before the semester ends.

While the version parsing could be trivially solved using regex matching,
I opted to build on the current logic for now. Should maybe come back to
it in the future.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/utils/version.py
Comment on lines +27 to +35
if ("beta" in version and len(parts) != 4) or ("beta" not in version and len(parts) != 3):
raise ValueError(
f"Invalid version string (expected 'MAJOR.MINOR.PATCH'): {version!r}"
f"Invalid version string (expected 'MAJOR.MINOR.PATCH[-beta.PRERELEASE]'): {version!r}"
)
try:
major, minor, patch = (int(part) for part in parts)
if "beta" in version:
version_part, prerelease_str = version.split("-beta.")
prerelease = int(prerelease_str)
major, minor, patch = (int(part) for part in version_part.split("."))
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

parse uses "beta" in version to decide beta parsing/validation. This can incorrectly route versions that merely contain the substring "beta" and it doesn't assert the presence of the -beta. separator before calling version.split("-beta."). Use a stricter check like "-beta." in version (and validate the split yields exactly 2 parts) to avoid false positives and confusing exceptions.

Copilot uses AI. Check for mistakes.
Comment thread app/utils/version.py
Comment on lines 46 to 55
"""Returns if the current version is behind the other version based on major and minor versions."""
if self.prerelease is not None and other.prerelease is not None:
return (other.major, other.minor, other.patch, other.prerelease) > (
self.major,
self.minor,
self.patch,
self.prerelease,
)
return (other.major, other.minor) > (self.major, self.minor)

Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

is_behind now compares (major, minor, patch, prerelease) only when both versions are prereleases, but falls back to comparing only (major, minor) for stable versions and for mixed stable/prerelease comparisons. This breaks SemVer ordering in common cases (e.g., 1.2.3-beta.1 should be behind 1.2.3, and 1.2.3 should be behind 1.2.4), and the docstring no longer matches behavior. Consider comparing (major, minor, patch) first in all cases, then applying prerelease ordering when base versions are equal (stable > prerelease; if both prerelease, compare prerelease number).

Suggested change
"""Returns if the current version is behind the other version based on major and minor versions."""
if self.prerelease is not None and other.prerelease is not None:
return (other.major, other.minor, other.patch, other.prerelease) > (
self.major,
self.minor,
self.patch,
self.prerelease,
)
return (other.major, other.minor) > (self.major, self.minor)
"""Return whether the current version is behind the other version using SemVer ordering."""
self_base = (self.major, self.minor, self.patch)
other_base = (other.major, other.minor, other.patch)
if self_base != other_base:
return self_base < other_base
if self.prerelease is None and other.prerelease is None:
return False
if self.prerelease is None:
return False
if other.prerelease is None:
return True
return self.prerelease < other.prerelease

Copilot uses AI. Check for mistakes.
Comment on lines +410 to +427
winget-publish:
needs: [prepare, windows]
if: needs.prepare.outputs.should_publish == 'true' && !contains(needs.prepare.outputs.ref_name, 'beta') # temporarily disable winget publishing

runs-on: windows-latest

permissions:
contents: read

steps:
- name: Submit to WinGet
uses: vedantmgoyal9/winget-releaser@v2
with:
identifier: GitMastery.GitMasteryBeta
version: ${{ needs.prepare.outputs.version_number }}
release-tag: ${{ needs.prepare.outputs.ref_name }}
token: ${{ secrets.ORG_PAT }}
installers-regex: '\.exe$'
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The winget-publish job is effectively unreachable in this workflow: the workflow triggers on v*.*.*-beta.* tags and is named/purposed for beta publishing, but the job additionally requires !contains(..., 'beta'), so it will never run for the intended beta tags. If WinGet publishing is intentionally disabled, consider removing the job or gating it behind an explicit workflow input so the condition is not contradictory/misleading.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +8
on:
workflow_dispatch:
secrets:
ORG_PAT:
required: true

Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

workflow_dispatch does not support a secrets: schema (only inputs:). As written, this won't actually enforce that ORG_PAT is provided, and the workflow may run and fail later with a confusing auth error. Consider removing this block and instead adding an early step that validates ${{ secrets.ORG_PAT }} is set (or use a protected environment with required reviewers/required secrets).

Copilot uses AI. Check for mistakes.
Comment thread app/utils/version.py
Comment on lines 15 to +19
only_version = version[1:]
if "beta" in only_version:
version_part, prerelease = only_version.split("-beta.")
[major, minor, patch] = version_part.split(".")
return Version(int(major), int(minor), int(patch), int(prerelease))
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

parse_version_string checks "beta" in only_version and then blindly splits on -beta.. This will mis-detect unrelated substrings (e.g., "alphabet") and will raise an unhelpful ValueError if the string contains "beta" but not the expected -beta. delimiter. Prefer checking for the exact -beta. marker and raising a clear ValueError (or falling back to stable parsing) when the beta format is malformed.

Copilot uses AI. Check for mistakes.
@jovnc
Copy link
Copy Markdown
Collaborator

jovnc commented Apr 16, 2026

@VikramGoyal23 feel free to merge and test once ur ready, let us know when it is ready so we can approve it

@VikramGoyal23
Copy link
Copy Markdown
Contributor Author

@jovnc It's ready, can be approved

@jovnc
Copy link
Copy Markdown
Collaborator

jovnc commented Apr 16, 2026

@VikramGoyal23 I have disabled require approval as of now, so feel free to merge the PRs and debug as necessary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants