fix: update release script
This commit is contained in:
@@ -194,8 +194,14 @@ generate_version_files() {
|
||||
|
||||
# ── version source (built-in) ──────────────────────────────────────────────
|
||||
|
||||
do_read_version() {
|
||||
if [[ ! -f "$ROOT_DIR/VERSION" ]]; then
|
||||
# Initializes $ROOT_DIR/VERSION from git tags if it doesn't exist.
|
||||
# Must be called outside of any subshell so log output stays on stderr
|
||||
# and never contaminates the stdout of do_read_version.
|
||||
init_version_file() {
|
||||
if [[ -f "$ROOT_DIR/VERSION" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local highest_tag=""
|
||||
while IFS= read -r raw_tag; do
|
||||
local tag="${raw_tag#v}"
|
||||
@@ -223,16 +229,15 @@ do_read_version() {
|
||||
|
||||
printf '%s\n%s\n%s\n' "$BASE_VERSION" "$channel_to_write" "$n_to_write" > "$ROOT_DIR/VERSION"
|
||||
log "Initialized $ROOT_DIR/VERSION from highest tag: v$highest_tag"
|
||||
fi
|
||||
}
|
||||
|
||||
do_read_version() {
|
||||
local base_line channel_line n_line
|
||||
base_line="$(sed -n '1p' "$ROOT_DIR/VERSION" | tr -d '\r')"
|
||||
channel_line="$(sed -n '2p' "$ROOT_DIR/VERSION" | tr -d '\r')"
|
||||
n_line="$(sed -n '3p' "$ROOT_DIR/VERSION" | tr -d '\r')"
|
||||
|
||||
if [[ -z $channel_line ]]; then
|
||||
printf '%s\n' "$base_line"
|
||||
elif [[ $channel_line == "stable" ]]; then
|
||||
if [[ -z $channel_line || $channel_line == "stable" ]]; then
|
||||
printf '%s\n' "$base_line"
|
||||
else
|
||||
printf '%s-%s.%s\n' "$base_line" "$channel_line" "$n_line"
|
||||
@@ -265,6 +270,10 @@ main() {
|
||||
START_HEAD="$(git rev-parse HEAD)"
|
||||
trap revert_on_failure ERR
|
||||
|
||||
# Initialize VERSION file outside any subshell so log lines never
|
||||
# bleed into the stdout capture below.
|
||||
init_version_file
|
||||
|
||||
local raw_version
|
||||
raw_version="$(do_read_version | grep -E '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z]+\.[0-9]+)?$' | tail -n1)"
|
||||
if [[ -z $raw_version ]]; then
|
||||
|
||||
Reference in New Issue
Block a user