Skip to content

Commit c1d2aaf

Browse files
committed
refactor(scripts): strip prefix
1 parent 351091c commit c1d2aaf

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

scripts/prepare_changelog.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
from pathlib import Path
44

55
TAG = os.environ["TAG"]
6-
VERSION = TAG[1:]
76

87

98
def main():
10-
print(f"Preparing changelog for {TAG}")
9+
print(f"Preparing changelog for v{TAG}")
1110
changelog = Path("CHANGELOG.md")
1211

1312
with changelog.open() as f:
@@ -18,7 +17,7 @@ def main():
1817
line = lines[i]
1918
if line.startswith("## Unreleased"):
2019
insert_index = i + 1
21-
elif line.startswith(f"## [v{VERSION}]"):
20+
elif line.startswith(f"## [v{TAG}]"):
2221
print("CHANGELOG already up-to-date")
2322
return
2423
elif line.startswith("## [v"):
@@ -30,7 +29,7 @@ def main():
3029
lines.insert(insert_index, "\n")
3130
lines.insert(
3231
insert_index + 1,
33-
f"## [v{VERSION}](https://github.com/stefanlogue/meteor/releases/tag/v{VERSION}) - "
32+
f"## [v{TAG}](https://github.com/stefanlogue/meteor/releases/tag/v{TAG}) - "
3433
f"{datetime.now().strftime('%Y-%m-%d')}\n",
3534
)
3635

scripts/release.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
set -e
44

5-
export TAG=$(svu next)
5+
export TAG=$(svu next --strip-prefix)
66

77
read -p "Creating new release for $TAG. Do you want to continue? [Y/n] " prompt
88

99
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
10-
python scripts/prepare_changelog.py
11-
git add CHANGELOG.md
12-
git commit -m "chore: bump version to $TAG for release" || true && git push
13-
echo "Creating new git tag $TAG"
14-
git tag "$TAG" -m "$TAG"
15-
git push --tags
10+
python scripts/prepare_changelog.py
11+
git add CHANGELOG.md
12+
git commit -m "chore: bump version to $TAG for release" || true && git push
13+
echo "Creating new git tag $TAG"
14+
git tag "$TAG" -m "$TAG"
15+
git push --tags
1616
else
17-
echo "Cancelled"
18-
exit 1
17+
echo "Cancelled"
18+
exit 1
1919
fi

0 commit comments

Comments
 (0)