From d3298050bbefb467e3587f9611e99add5b1688f3 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Fri, 14 Aug 2026 11:08:39 -0400 Subject: [PATCH] Remove tag requirement --- bin/omarchy-pkgs | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/bin/omarchy-pkgs b/bin/omarchy-pkgs index 0c3be82..94dad91 100755 --- a/bin/omarchy-pkgs +++ b/bin/omarchy-pkgs @@ -29,7 +29,9 @@ show_usage() { Usage: $0 [options] Commands: - release Cut a release from an upstream tag + release Cut a release from an upstream tag; if the + tag doesn't exist, uses the tip of quattro + (or --ref/--commit) with that version release latest [rc|beta|alpha] Cut from the newest upstream tag, optionally restricted to one pre-release channel release rc [vX.Y.Z] Newest upstream vX.Y.Z-rcN tag → X.Y.ZrcN @@ -367,8 +369,12 @@ cmd_release() { print_error "Usage: $0 release [options]" exit 1 fi - if [[ ! "$target" =~ ^(rc|beta|alpha)$ && ( -n "$base" || -n "$commit_arg" || -n "$ref" ) ]]; then - print_error "--base/--commit/--ref only apply to pre-release modes (rc/beta/alpha)" + if [[ ! "$target" =~ ^(rc|beta|alpha)$ && -n "$base" ]]; then + print_error "--base only applies to pre-release modes (rc/beta/alpha)" + exit 1 + fi + if [[ "$target" == "latest" && ( -n "$commit_arg" || -n "$ref" ) ]]; then + print_error "--commit/--ref do not apply to 'release latest'" exit 1 fi @@ -469,15 +475,33 @@ cmd_release() { v*) pkgver=$(normalize_tag "$target") || { print_error "Cannot parse '$target' as a release tag." - print_error "Accepted: vX.Y.Z, vX.Y.Z-rcN, vX.Y.Z-rc.N, vX.Y.Z.rcN, vX.Y.Z_rcN" + print_error "Accepted: vX.Y.Z, vX.Y.Z-rcN, vX.Y.Z-rc.N, vX.Y.Z.rcN, vX.Y.Z_rcN (beta/alpha too)" exit 1 } tag="$target" - print_info "Resolving $tag upstream..." - commit=$(resolve_tag_commit "$tag") - if [[ -z "$commit" ]]; then - print_error "Tag '$tag' not found at $UPSTREAM_URL" - exit 1 + if [[ -n "$commit_arg" ]]; then + # Explicit commit wins — release this version from exactly that commit. + ensure_clone + commit=$(git -C "$CLONE_DIR" rev-parse --verify --quiet "$commit_arg^{commit}") || { + print_error "Commit '$commit_arg' not found in upstream $UPSTREAM_URL" + exit 1 + } + tag="" + print_warning "Releasing $pkgver from explicit commit ${commit:0:12} (no upstream tag)" + else + print_info "Resolving $tag upstream..." + commit=$(resolve_tag_commit "$tag") + if [[ -z "$commit" ]]; then + # No such tag: fall back to the branch tip, like the rc flow. + ref="${ref:-$DEFAULT_RC_REF}" + commit=$(resolve_ref_commit "$ref") + if [[ -z "$commit" ]]; then + print_error "Tag '$tag' not found and branch '$ref' not found at $UPSTREAM_URL" + exit 1 + fi + tag="" + print_warning "Tag '$target' not found upstream — releasing $pkgver from the tip of '$ref' (${commit:0:12})" + fi fi ;; *)