1616 custom_version :
1717 type : string
1818 required : false
19- description : " Custom version (ignore for other bump types)"
20- generate_pre_release :
21- type : boolean
22- default : true
23- required : true
24- description : " Generate a RC build"
19+ description : " Custom version (ignored for other bump types)"
2520
2621permissions :
2722 contents : write
@@ -75,11 +70,14 @@ jobs:
7570 env :
7671 CURR : ${{ steps.meta.outputs.current_version }}
7772 CUSTOM : ${{ inputs.custom_version }}
78- BUMP : ${{ inputs.bump }}
73+ BUMP : ${{ inputs.version_bump }}
7974 run : |
8075 set -euo pipefail
8176
82- if [[ -n "${CUSTOM:-}" ]]; then then
77+ if [[ -n "${CUSTOM:-}" ]]; then
78+ echo "new_version=$CUSTOM" >> "$GITHUB_OUTPUT"
79+ echo "Custom Bumped: $CURR -> $CUSTOM"
80+ else
8381 # strip any pre-release / build metadata for arithmetic (e.g., -rc.1, +build.5)
8482 BASE="${CURR%%[-+]*}"
8583
9593 NEW_VERSION="$MA.$MI.$PA"
9694 echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
9795 echo "Bumped: $CURR -> $NEW_VERSION"
98- else
99- echo "new_version=$CUSTOM" >> "$GITHUB_OUTPUT"
100- echo "Bumped: $CURR -> $CUSTOM"
10196 fi
10297
10398 - name : Prepare release branch
@@ -119,26 +114,32 @@ jobs:
119114 NEW_VERSION : ${{ steps.bump.outputs.new_version }}
120115 run : |
121116 python3 - <<'PY'
117+ try:
122118 import os, re, sys, glob, pathlib
123-
119+
124120 current_version = os.environ["CURR_VERSION"]
125121 new_version = os.environ["NEW_VERSION"]
126-
122+
123+ print(f"current={current_version} new={new_version}")
124+
127125 # negative lookbehind (word,., or -) + optional 'v' + the escaped current version + negative lookahead (word or .)
128126 # e.g. current version of 1.0.1 will match 1.0.1, v1.0.1, v1.0.1-rc.1
129127 # e.g. current version of 1.0.1 will not match ver1.0.1, 1.0.1x, 1.0.11, 1.0.1.beta
130128 pat = re.compile(rf'(?<![\w.-])(v?){re.escape(current_version)}(?![\w.])')
131-
129+
132130 def repl(m) : # preserve 'v' prefix if it existed
133131 return (m.group(1) or '') + new_version
134-
132+
135133 # Targets to update
136134 targets = [
137135 " scripts/nix/install.sh" , # nix shell script
138136 " scripts/windows/install.ps1" , # PowerShell
139137 *glob.glob("**/*.mdx", recursive=True), # docs
140138 ]
141-
139+
140+ print(targets)
141+ print(f"Scanning {len(targets)} targets…")
142+
142143 changed = 0
143144 for path in targets :
144145 p = pathlib.Path(path)
@@ -150,9 +151,14 @@ jobs:
150151 p.write_text(new_txt, encoding="utf-8")
151152 print(f"Updated {path} ({n} occurrence{'s' if n!=1 else ''})")
152153 changed += n
153-
154+
154155 if changed == 0 :
155- sys.exit("::warning::No occurrences of the current version were found.")
156+ print("::error::No occurrences of the current version were found.", file=sys.stderr)
157+ sys.exit(1)
158+ except Exception :
159+ import traceback
160+ traceback.print_exc()
161+ sys.exit(1)
156162 PY
157163
158164 - name : Push changes to release branch
0 commit comments