Skip to content

Commit dafe836

Browse files
committed
Added workaround for naming bug when pushing via OIDC
1 parent 75437f8 commit dafe836

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

.github/workflows/pr-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Get Hatch version
3030
id: version
3131
run: |
32-
VERSION=$(hatch version)
32+
VERSION=$(hatch version | cut -d+ -f1)
3333
echo "VERSION=$VERSION" >> $GITHUB_ENV
3434
3535
- name: Check if version exists on Test PyPI

.hooks/sync_version.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
PACKAGE_FILE = pathlib.Path("socketsecurity/__init__.py")
88
VERSION_PATTERN = re.compile(r"__version__\s*=\s*['\"]([^'\"]+)['\"]")
99

10-
def get_hatch_version(full=False):
11-
raw = subprocess.check_output(["hatch", "version"], text=True).strip()
12-
if full:
13-
return raw
14-
return raw.split(".dev")[0].split("+")[0] # Just base version
10+
def get_hatch_version(full=False, strip_local=False):
11+
version = subprocess.check_output(["hatch", "version"], text=True).strip()
12+
if not full or strip_local:
13+
version = version.split("+")[0] # strip local metadata
14+
return version
1515

1616
def get_current_version():
1717
content = PACKAGE_FILE.read_text()
@@ -25,7 +25,7 @@ def update_version(new_version):
2525

2626
def main():
2727
full_mode = "--dev" in sys.argv
28-
hatch_version = get_hatch_version(full=full_mode)
28+
hatch_version = get_hatch_version(full=full_mode, strip_local=full_mode)
2929
current_version = get_current_version()
3030

3131
if not current_version:
@@ -35,8 +35,6 @@ def main():
3535
if hatch_version != current_version:
3636
print(f"🔁 Updating version: {current_version}{hatch_version}")
3737
update_version(hatch_version)
38-
39-
# In --dev mode, we don't fail — we expect this to update it
4038
return 0 if full_mode else 1
4139

4240
print(f"✅ Version is in sync: {hatch_version}")

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.0.24'
2+
__version__ = '2.0.25'

0 commit comments

Comments
 (0)