Skip to content

Commit 72c85e8

Browse files
committed
Fix release policy parsing and semver release baselines
1 parent c4a994a commit 72c85e8

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

.github/workflows/skills-release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ jobs:
4646
id: policy
4747
run: |
4848
python - << 'PY'
49+
import re
4950
from pathlib import Path
51+
5052
txt = Path('.release-policy.yml').read_text(encoding='utf-8')
51-
auto = 'auto_release: true' in txt
53+
m = re.search(r"(?im)^\s*auto_release\s*:\s*(true|false)\s*(?:#.*)?$", txt)
54+
auto = bool(m and m.group(1).lower() == 'true')
5255
with open(Path.cwd() / '.policy_out', 'w', encoding='utf-8') as f:
5356
f.write(f"auto_release={'true' if auto else 'false'}\n")
5457
PY
@@ -125,11 +128,11 @@ jobs:
125128
if: steps.gate.outputs.should_release == 'true'
126129
id: range
127130
run: |
128-
PREV=$(git tag --list 'v*' --sort=-v:refname | head -n 1 || true)
131+
PREV=$(git tag --list 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1 || true)
129132
if [ -n "$PREV" ]; then
130133
FROM="$PREV"
131134
else
132-
FROM=$(git rev-list --max-parents=0 HEAD)
135+
FROM=$(git hash-object -t tree /dev/null)
133136
fi
134137
echo "from_ref=$FROM" >> "$GITHUB_OUTPUT"
135138
echo "to_ref=${GITHUB_SHA}" >> "$GITHUB_OUTPUT"

scripts/compute_next_version.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def latest_tag() -> tuple[int, int, int]:
1515
).strip()
1616
if not out:
1717
return (0, 0, 0)
18-
first = out.splitlines()[0].strip()
19-
m = TAG_RE.match(first)
20-
if not m:
21-
return (0, 0, 0)
22-
return tuple(int(m.group(i)) for i in (1, 2, 3))
18+
for tag in out.splitlines():
19+
m = TAG_RE.match(tag.strip())
20+
if m:
21+
return tuple(int(m.group(i)) for i in (1, 2, 3))
22+
return (0, 0, 0)
2323

2424

2525
def bump_from_labels(labels: list[str]) -> str:

0 commit comments

Comments
 (0)