Skip to content

Commit 366ea6a

Browse files
author
Peter Giacomo Lombardo
committed
New general release creation script
1 parent 032b220 commit 366ea6a

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

bin/create_general_release.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env python
2+
# Script to make a new python-sensor release on Github
3+
# Requires the Github CLI to be installed and configured: https://github.com/cli/cli
4+
5+
import os
6+
import sys
7+
import distutils.spawn
8+
from subprocess import check_output
9+
10+
if len(sys.argv) != 2:
11+
raise ValueError('Please specify the version to release. e.g. "1.27.1"')
12+
13+
if sys.argv[1] in ['-h', '--help']:
14+
filename = os.path.basename(__file__)
15+
print("Usage: %s <version number>" % filename)
16+
print("Exampe: %s 1.27.1" % filename)
17+
print("")
18+
print("This will create a release on Github such as:")
19+
print("https://github.com/instana/python-sensor/releases/tag/v1.27.1")
20+
21+
22+
# Check requirements first
23+
for cmd in ["gh"]:
24+
if distutils.spawn.find_executable(cmd) is None:
25+
print("Can't find required tool: %s" % cmd)
26+
sys.exit(1)
27+
28+
version = sys.argv[1]
29+
semantic_version = 'v' + version
30+
title = version
31+
32+
body = """
33+
This release includes the following fixes & improvements:
34+
35+
*
36+
37+
Available on PyPI:
38+
https://pypi.python.org/pypi/instana/%s
39+
""" % version
40+
41+
response = check_output(["gh", "release", "create", semantic_version,
42+
"-d", # draft
43+
"-R", "instana/python-sensor",
44+
"-t", semantic_version,
45+
"-n", body])
46+
47+
48+
print("If there weren't any failures, the draft release is available at:")
49+
print(response.strip().decode())

0 commit comments

Comments
 (0)