16
16
custom_version :
17
17
type : string
18
18
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)"
25
20
26
21
permissions :
27
22
contents : write
@@ -75,11 +70,14 @@ jobs:
75
70
env :
76
71
CURR : ${{ steps.meta.outputs.current_version }}
77
72
CUSTOM : ${{ inputs.custom_version }}
78
- BUMP : ${{ inputs.bump }}
73
+ BUMP : ${{ inputs.version_bump }}
79
74
run : |
80
75
set -euo pipefail
81
76
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
83
81
# strip any pre-release / build metadata for arithmetic (e.g., -rc.1, +build.5)
84
82
BASE="${CURR%%[-+]*}"
85
83
95
93
NEW_VERSION="$MA.$MI.$PA"
96
94
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
97
95
echo "Bumped: $CURR -> $NEW_VERSION"
98
- else
99
- echo "new_version=$CUSTOM" >> "$GITHUB_OUTPUT"
100
- echo "Bumped: $CURR -> $CUSTOM"
101
96
fi
102
97
103
98
- name : Prepare release branch
@@ -119,26 +114,32 @@ jobs:
119
114
NEW_VERSION : ${{ steps.bump.outputs.new_version }}
120
115
run : |
121
116
python3 - <<'PY'
117
+ try:
122
118
import os, re, sys, glob, pathlib
123
-
119
+
124
120
current_version = os.environ["CURR_VERSION"]
125
121
new_version = os.environ["NEW_VERSION"]
126
-
122
+
123
+ print(f"current={current_version} new={new_version}")
124
+
127
125
# negative lookbehind (word,., or -) + optional 'v' + the escaped current version + negative lookahead (word or .)
128
126
# e.g. current version of 1.0.1 will match 1.0.1, v1.0.1, v1.0.1-rc.1
129
127
# e.g. current version of 1.0.1 will not match ver1.0.1, 1.0.1x, 1.0.11, 1.0.1.beta
130
128
pat = re.compile(rf'(?<![\w.-])(v?){re.escape(current_version)}(?![\w.])')
131
-
129
+
132
130
def repl(m) : # preserve 'v' prefix if it existed
133
131
return (m.group(1) or '') + new_version
134
-
132
+
135
133
# Targets to update
136
134
targets = [
137
135
" scripts/nix/install.sh" , # nix shell script
138
136
" scripts/windows/install.ps1" , # PowerShell
139
137
*glob.glob("**/*.mdx", recursive=True), # docs
140
138
]
141
-
139
+
140
+ print(targets)
141
+ print(f"Scanning {len(targets)} targets…")
142
+
142
143
changed = 0
143
144
for path in targets :
144
145
p = pathlib.Path(path)
@@ -150,9 +151,14 @@ jobs:
150
151
p.write_text(new_txt, encoding="utf-8")
151
152
print(f"Updated {path} ({n} occurrence{'s' if n!=1 else ''})")
152
153
changed += n
153
-
154
+
154
155
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)
156
162
PY
157
163
158
164
- name : Push changes to release branch
0 commit comments