Skip to content

Commit a80f7b6

Browse files
authored
0.4.3 (#160)
# Pull Request Fixes # ## Proposed Changes - - - --------- Co-authored-by: viseshrp <[email protected]>
1 parent 58993f9 commit a80f7b6

File tree

5 files changed

+58
-67
lines changed

5 files changed

+58
-67
lines changed

.cruft.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "https://github.com/viseshrp/yapc",
3-
"commit": "7e735f29908dbe256f42fe788aa5ad31e905e4cf",
3+
"commit": "b123cc504566db88232428f02c8c72f913433f9b",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {
@@ -16,7 +16,7 @@
1616
"git_init": "n",
1717
"github_actions": "y",
1818
"_template": "https://github.com/viseshrp/yapc",
19-
"_commit": "7e735f29908dbe256f42fe788aa5ad31e905e4cf"
19+
"_commit": "b123cc504566db88232428f02c8c72f913433f9b"
2020
}
2121
},
2222
"directory": null

CHANGELOG.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/),
66
and this project adheres to [Semantic Versioning](https://semver.org/).
77

8-
## [0.5.0] - <Unreleased>
9-
10-
### Added
11-
12-
- TODO: Add ability to add/update packages in pyproject.toml files.
8+
## [0.4.3] - 2025-06-11
139

1410
### Changed
1511

scripts/check_changelog_date.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Check release date for a given version in CHANGELOG.md.
4+
"""
5+
6+
from datetime import date
7+
from pathlib import Path
8+
import sys
9+
10+
CHANGELOG_PATH = Path("CHANGELOG.md")
11+
12+
13+
def main(version: str) -> None:
14+
if not CHANGELOG_PATH.exists():
15+
print(f"❌ ERROR: {CHANGELOG_PATH} does not exist.")
16+
sys.exit(1)
17+
18+
today = date.today().isoformat()
19+
target_line = f"## [{version}] - {today}"
20+
21+
found = False
22+
lines = CHANGELOG_PATH.read_text(encoding="utf-8").splitlines()
23+
24+
for i, line in enumerate(lines):
25+
if line.strip() == target_line:
26+
print(f"🔍 Found line {i + 1}: {target_line}")
27+
found = True
28+
break
29+
30+
if not found:
31+
print("❌ ERROR: CHANGELOG.md is not ready for release.")
32+
print(f" Expected line: {target_line}")
33+
print("Tip: Check if it's still marked as '[Unreleased]' and update it to today's date.")
34+
sys.exit(1)
35+
36+
37+
if __name__ == "__main__":
38+
if len(sys.argv) != 2:
39+
print("Usage: uv run python scripts/check_changelog_date.py <version>")
40+
sys.exit(1)
41+
42+
main(sys.argv[1])

scripts/fix_changelog_date.py

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

scripts/tag_release.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
#!/usr/bin/env bash
2-
32
set -euo pipefail
43

54
VERSION=$(hatch version | sed 's/\.dev.*//')
65
echo "🏷 Releasing version: $VERSION"
76

87
# Update changelog date for this version
9-
uv run python scripts/fix_changelog_date.py "$VERSION"
8+
uv run python scripts/check_changelog_date.py "$VERSION"
9+
10+
# Assert we're on main and clean
11+
branch=$(git rev-parse --abbrev-ref HEAD)
12+
if [[ "$branch" != "main" ]]; then
13+
echo "❌ ERROR: Must be on main branch to tag a release."
14+
exit 1
15+
fi
1016

11-
# Only commit if the changelog was actually updated
12-
if ! git diff --quiet --exit-code CHANGELOG.md; then
13-
echo "✅ CHANGELOG.md updated, committing..."
14-
git add CHANGELOG.md
15-
git commit -m "📄 Update changelog for v$VERSION"
16-
else
17-
echo "ℹ️ No changes to CHANGELOG.md. Skipping commit."
17+
if ! git diff --quiet HEAD; then
18+
echo "❌ ERROR: Working directory is dirty. Commit your changes through a PR."
19+
exit 1
1820
fi
1921

20-
# Always tag and push (tagging the latest HEAD whether or not changelog changed)
22+
# Create and push tag only
2123
git tag "v$VERSION" -m "Release v$VERSION"
2224
git push origin "v$VERSION"
25+
echo "✅ Tag v$VERSION pushed successfully."

0 commit comments

Comments
 (0)