rlsbl 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/package.json +1 -1
- package/rlsbl/commands/release.py +5 -1
- package/rlsbl/commands/undo.py +2 -2
- package/rlsbl/utils.py +19 -11
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="logo.svg" alt="rlsbl" width="336" height="105">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# rlsbl
|
|
2
6
|
|
|
3
7
|
Release orchestration and project scaffolding CLI for npm, PyPI, and Go.
|
|
@@ -146,6 +150,12 @@ The first version must be published manually before CI can take over:
|
|
|
146
150
|
|
|
147
151
|
After configuration, all subsequent releases are handled by CI when `rlsbl release` creates a GitHub Release. Go projects use GoReleaser in CI (via GitHub Actions) to build cross-platform binaries.
|
|
148
152
|
|
|
153
|
+
## Environment variables
|
|
154
|
+
|
|
155
|
+
| Variable | Default | Description |
|
|
156
|
+
|----------|---------|-------------|
|
|
157
|
+
| `RLSBL_PUSH_TIMEOUT` | `120` | Timeout in seconds for `git push` operations. Increase if your pre-push hooks (e.g. test suites) take longer than 2 minutes. |
|
|
158
|
+
|
|
149
159
|
## Requirements
|
|
150
160
|
|
|
151
161
|
- Node 18+
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ from ..utils import (
|
|
|
12
12
|
extract_changelog_entry,
|
|
13
13
|
find_commit_tool,
|
|
14
14
|
get_current_branch,
|
|
15
|
+
get_push_timeout,
|
|
15
16
|
is_clean_tree,
|
|
16
17
|
push_if_needed,
|
|
17
18
|
run,
|
|
@@ -207,8 +208,11 @@ def run_cmd(registry, args, flags):
|
|
|
207
208
|
log(f"Tagged: {tag}")
|
|
208
209
|
|
|
209
210
|
# Push commits and tag
|
|
211
|
+
push_timeout = get_push_timeout()
|
|
212
|
+
if push_timeout != 120:
|
|
213
|
+
log(f"Push timeout: {push_timeout}s (from RLSBL_PUSH_TIMEOUT)")
|
|
210
214
|
push_if_needed(branch)
|
|
211
|
-
run("git", ["push", "origin", tag])
|
|
215
|
+
run("git", ["push", "origin", tag], timeout=push_timeout)
|
|
212
216
|
log(f"Pushed to origin/{branch}")
|
|
213
217
|
|
|
214
218
|
# Create GitHub Release using a temp notes file
|
package/rlsbl/commands/undo.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
4
|
|
|
5
|
-
from ..utils import run,
|
|
5
|
+
from ..utils import run, check_gh_installed, check_gh_auth, get_push_timeout
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def run_cmd(registry, args, flags):
|
|
@@ -40,7 +40,7 @@ def run_cmd(registry, args, flags):
|
|
|
40
40
|
|
|
41
41
|
# Delete remote tag
|
|
42
42
|
try:
|
|
43
|
-
run("git", ["push", "origin", f":{tag}"])
|
|
43
|
+
run("git", ["push", "origin", f":{tag}"], timeout=get_push_timeout())
|
|
44
44
|
print(f"Deleted remote tag: {tag}")
|
|
45
45
|
except Exception as e:
|
|
46
46
|
print(f"Warning: could not delete remote tag: {e}")
|
package/rlsbl/utils.py
CHANGED
|
@@ -7,21 +7,13 @@ import subprocess
|
|
|
7
7
|
import sys
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def run(cmd, args=None, timeout=
|
|
10
|
+
def run(cmd, args=None, timeout=120):
|
|
11
11
|
"""Run a command with args, return trimmed stdout. Raise on failure."""
|
|
12
12
|
full_cmd = [cmd] + (args or [])
|
|
13
13
|
result = subprocess.run(full_cmd, capture_output=True, text=True, check=True, timeout=timeout)
|
|
14
14
|
return result.stdout.strip()
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
def run_silent(cmd, args=None, timeout=30):
|
|
18
|
-
"""Run a command suppressing stderr. Return trimmed stdout. Raise on failure."""
|
|
19
|
-
full_cmd = [cmd] + (args or [])
|
|
20
|
-
result = subprocess.run(
|
|
21
|
-
full_cmd, capture_output=True, text=True, check=True, timeout=timeout,
|
|
22
|
-
)
|
|
23
|
-
return result.stdout.strip()
|
|
24
|
-
|
|
25
17
|
|
|
26
18
|
def is_clean_tree():
|
|
27
19
|
"""Returns True if the git working tree is clean (no uncommitted changes)."""
|
|
@@ -34,18 +26,34 @@ def get_current_branch():
|
|
|
34
26
|
return run("git", ["rev-parse", "--abbrev-ref", "HEAD"])
|
|
35
27
|
|
|
36
28
|
|
|
29
|
+
def get_push_timeout():
|
|
30
|
+
"""Return the push timeout in seconds, from RLSBL_PUSH_TIMEOUT or default 120."""
|
|
31
|
+
raw = os.environ.get("RLSBL_PUSH_TIMEOUT")
|
|
32
|
+
if raw is None:
|
|
33
|
+
return 120
|
|
34
|
+
try:
|
|
35
|
+
val = int(raw)
|
|
36
|
+
if val <= 0:
|
|
37
|
+
raise ValueError
|
|
38
|
+
return val
|
|
39
|
+
except ValueError:
|
|
40
|
+
print(f'Warning: invalid RLSBL_PUSH_TIMEOUT="{raw}", using default 120s', file=sys.stderr)
|
|
41
|
+
return 120
|
|
42
|
+
|
|
43
|
+
|
|
37
44
|
def push_if_needed(branch):
|
|
38
45
|
"""Push the branch to origin if local is ahead of remote."""
|
|
46
|
+
timeout = get_push_timeout()
|
|
39
47
|
local = run("git", ["rev-parse", branch])
|
|
40
48
|
try:
|
|
41
49
|
remote = run("git", ["rev-parse", f"origin/{branch}"])
|
|
42
50
|
except subprocess.CalledProcessError:
|
|
43
51
|
# Remote branch doesn't exist yet; push it
|
|
44
|
-
run("git", ["push", "-u", "origin", branch])
|
|
52
|
+
run("git", ["push", "-u", "origin", branch], timeout=timeout)
|
|
45
53
|
return
|
|
46
54
|
|
|
47
55
|
if local != remote:
|
|
48
|
-
run("git", ["push", "origin", branch])
|
|
56
|
+
run("git", ["push", "origin", branch], timeout=timeout)
|
|
49
57
|
|
|
50
58
|
|
|
51
59
|
def extract_changelog_entry(changelog_path, version):
|