Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
pfmoore
editables
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
editables
/
bump_release.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
43 lines (35 loc) · 1.22 KB
main
Breadcrumbs
editables
/
bump_release.py
Copy path
Top
File metadata and controls
Code
Blame
43 lines (35 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Very hacky script to bump the version when cutting a new release.
#
# This does the following:
#
# 1. Edit the version number in the 3 places in the code it's specified
# 2. Commit the change to git
# 3. Tag the commit with the version
#
# Note - this assumes that you will *immediately* release the new version,
# if you make changes before doing so, the tag will not match the release.
import re
import subprocess
import sys
from pathlib import Path
new_version = sys.argv[1]
files = [
("src/editables/__init__.py", r'^__version__ = "(\d+\.\d+)"$'),
("pyproject.toml", r'^version = "(\d+\.\d+)"$'),
("docs/source/conf.py", r'^release = "(\d+\.\d+)"$'),
]
def repl(m):
# Replace group 1 with new_version
return (
m.group(0)[: m.start(1) - m.start(0)]
+ new_version
+ m.group(0)[m.end(1) - m.start(0) :]
)
for file, regex in files:
file = Path(file)
content = file.read_text(encoding="utf-8")
new_content = re.sub(regex, repl, content, flags=re.MULTILINE)
file.write_text(new_content, encoding="utf-8")
subprocess.run(["git", "add"] + [f for f, re in files])
subprocess.run(["git", "commit", "-m", f"Bump version to {new_version}"])
subprocess.run(["git", "tag", new_version])
You can’t perform that action at this time.