Skip to content

Commit 16dd557

Browse files
refactor: Remove extract_version script, parse from PR title instead
Simplify the release workflow by parsing versions directly from the PR title instead of maintaining a separate script to extract from CHANGELOG.md. Benefits: - No custom scripts needed - one less moving part - Uses the version explicitly approved in the PR title - Simpler and more maintainable - Consistent with the principle of minimal scripting The create-release-tags workflow now extracts versions using grep -oP directly from the PR title format: 'Release: setuptools-scm vX.Y.Z, vcs-versioning vX.Y.Z' Updated documentation to reflect that no custom scripts are required.
1 parent c56cb24 commit 16dd557

File tree

4 files changed

+20
-84
lines changed

4 files changed

+20
-84
lines changed

.github/scripts/extract_version.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ The workflow system is designed with these principles:
130130
4. **Project-prefixed tags** - Enable monorepo releases (`project-vX.Y.Z`)
131131
5. **Automated but controlled** - Automation with human approval gates
132132
6. **Fail fast** - No fallback values; workflows fail explicitly if required data is missing
133+
7. **No custom scripts** - Uses PR title parsing and built-in tools only
133134

134135
## Version Bump Logic
135136

.github/workflows/create-release-tags.yml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,17 @@ jobs:
3939
set -e
4040
4141
TAGS_CREATED=""
42+
PR_TITLE="${{ github.event.pull_request.title }}"
4243
4344
# Check if we should release setuptools-scm
4445
if echo "${{ toJson(github.event.pull_request.labels.*.name) }}" | grep -q "release:setuptools-scm"; then
45-
cd setuptools-scm
46-
47-
if [ ! -f "CHANGELOG.md" ]; then
48-
echo "ERROR: CHANGELOG.md not found for setuptools-scm"
49-
exit 1
50-
fi
51-
52-
VERSION=$(python ../.github/scripts/extract_version.py CHANGELOG.md)
46+
# Extract version from PR title: "Release: setuptools-scm v9.3.0, ..."
47+
VERSION=$(echo "$PR_TITLE" | grep -oP 'setuptools-scm v\K[0-9]+\.[0-9]+\.[0-9]+')
5348
5449
if [ -z "$VERSION" ]; then
55-
echo "ERROR: Failed to extract version from setuptools-scm CHANGELOG.md"
56-
echo "The CHANGELOG.md file must contain a version heading"
50+
echo "ERROR: Failed to extract setuptools-scm version from PR title"
51+
echo "PR title: $PR_TITLE"
52+
echo "Expected format: 'Release: setuptools-scm vX.Y.Z'"
5753
exit 1
5854
fi
5955
@@ -66,24 +62,17 @@ jobs:
6662
TAGS_CREATED="$TAGS_CREATED $TAG"
6763
echo "setuptools_scm_tag=$TAG" >> $GITHUB_OUTPUT
6864
echo "setuptools_scm_version=$VERSION" >> $GITHUB_OUTPUT
69-
70-
cd ..
7165
fi
7266
7367
# Check if we should release vcs-versioning
7468
if echo "${{ toJson(github.event.pull_request.labels.*.name) }}" | grep -q "release:vcs-versioning"; then
75-
cd vcs-versioning
76-
77-
if [ ! -f "CHANGELOG.md" ]; then
78-
echo "ERROR: CHANGELOG.md not found for vcs-versioning"
79-
exit 1
80-
fi
81-
82-
VERSION=$(python ../.github/scripts/extract_version.py CHANGELOG.md)
69+
# Extract version from PR title: "Release: ..., vcs-versioning v0.2.0"
70+
VERSION=$(echo "$PR_TITLE" | grep -oP 'vcs-versioning v\K[0-9]+\.[0-9]+\.[0-9]+')
8371
8472
if [ -z "$VERSION" ]; then
85-
echo "ERROR: Failed to extract version from vcs-versioning CHANGELOG.md"
86-
echo "The CHANGELOG.md file must contain a version heading"
73+
echo "ERROR: Failed to extract vcs-versioning version from PR title"
74+
echo "PR title: $PR_TITLE"
75+
echo "Expected format: 'Release: vcs-versioning vX.Y.Z'"
8776
exit 1
8877
fi
8978
@@ -96,8 +85,6 @@ jobs:
9685
TAGS_CREATED="$TAGS_CREATED $TAG"
9786
echo "vcs_versioning_tag=$TAG" >> $GITHUB_OUTPUT
9887
echo "vcs_versioning_version=$VERSION" >> $GITHUB_OUTPUT
99-
100-
cd ..
10188
fi
10289
10390
echo "tags_created=$TAGS_CREATED" >> $GITHUB_OUTPUT

RELEASE_SYSTEM.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,21 @@ jobs:
9797

9898
### 6. Helper Scripts ✅
9999

100-
**Only one simple script:**
101-
- `.github/scripts/extract_version.py` - Extracts version from CHANGELOG.md after towncrier builds it
100+
**No custom scripts needed!** ✅
101+
102+
All version handling is done through:
103+
- Version scheme for version calculation
104+
- PR title parsing for tag creation
105+
- vcs-versioning CLI for querying versions
102106

103107
**Removed duplicate logic:**
104108
- ❌ No version bump calculation scripts
105109
- ❌ No duplicate version determination logic
106110
- ❌ No fallback values or default versions
111+
- ❌ No helper scripts for version extraction
107112
- ✅ Version scheme is the **single source of truth**
108113
- ✅ Workflows fail explicitly if required data is missing
114+
- ✅ Simple PR title parsing for tags
109115

110116
### 7. Comprehensive Documentation ✅
111117

0 commit comments

Comments
 (0)