chore(release): bump version to 0.3.6.0-rc1 and support prerelease metadata
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 4m56s
Release Binaries & Packages / Build & Release Standalone Binaries (Linux & Windows Cross-Compilation) (push) Successful in 5m40s
Build and Push LOGAR Runner / Build & Push Runner Image (push) Successful in 11m54s
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 4m56s
Release Binaries & Packages / Build & Release Standalone Binaries (Linux & Windows Cross-Compilation) (push) Successful in 5m40s
Build and Push LOGAR Runner / Build & Push Runner Image (push) Successful in 11m54s
This commit is contained in:
@@ -82,7 +82,7 @@ def upload_file_to_release(base_url, repo, release_id, token, file_path, max_ret
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def create_or_get_release(base_url, repo, tag, token, title=None, notes=None):
|
def create_or_get_release(base_url, repo, tag, token, title=None, notes=None, prerelease=None):
|
||||||
url = f"{base_url}/api/v1/repos/{repo}/releases"
|
url = f"{base_url}/api/v1/repos/{repo}/releases"
|
||||||
headers = {
|
headers = {
|
||||||
"Authorization": get_auth_header(token),
|
"Authorization": get_auth_header(token),
|
||||||
@@ -90,6 +90,8 @@ def create_or_get_release(base_url, repo, tag, token, title=None, notes=None):
|
|||||||
"Accept": "application/json"
|
"Accept": "application/json"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_prerelease = prerelease if prerelease is not None else any(x in tag.lower() for x in ["-rc", "-pre", "-beta", "-alpha", "preview"])
|
||||||
|
|
||||||
# Check if release exists
|
# Check if release exists
|
||||||
check_url = f"{base_url}/api/v1/repos/{repo}/releases/tags/{urllib.parse.quote(tag)}"
|
check_url = f"{base_url}/api/v1/repos/{repo}/releases/tags/{urllib.parse.quote(tag)}"
|
||||||
check_req = urllib.request.Request(check_url, headers={"Authorization": get_auth_header(token)})
|
check_req = urllib.request.Request(check_url, headers={"Authorization": get_auth_header(token)})
|
||||||
@@ -97,13 +99,15 @@ def create_or_get_release(base_url, repo, tag, token, title=None, notes=None):
|
|||||||
with urllib.request.urlopen(check_req) as resp:
|
with urllib.request.urlopen(check_req) as resp:
|
||||||
existing = json.loads(resp.read().decode("utf-8"))
|
existing = json.loads(resp.read().decode("utf-8"))
|
||||||
print(f"[*] Found existing release for tag {tag} (ID: {existing['id']})")
|
print(f"[*] Found existing release for tag {tag} (ID: {existing['id']})")
|
||||||
if notes or title:
|
if notes or title or (prerelease is not None):
|
||||||
patch_url = f"{base_url}/api/v1/repos/{repo}/releases/{existing['id']}"
|
patch_url = f"{base_url}/api/v1/repos/{repo}/releases/{existing['id']}"
|
||||||
patch_payload = {}
|
patch_payload = {}
|
||||||
if title:
|
if title:
|
||||||
patch_payload["name"] = title
|
patch_payload["name"] = title
|
||||||
if notes:
|
if notes:
|
||||||
patch_payload["body"] = notes
|
patch_payload["body"] = notes
|
||||||
|
if prerelease is not None:
|
||||||
|
patch_payload["prerelease"] = is_prerelease
|
||||||
patch_req = urllib.request.Request(
|
patch_req = urllib.request.Request(
|
||||||
patch_url,
|
patch_url,
|
||||||
data=json.dumps(patch_payload).encode("utf-8"),
|
data=json.dumps(patch_payload).encode("utf-8"),
|
||||||
@@ -125,7 +129,7 @@ def create_or_get_release(base_url, repo, tag, token, title=None, notes=None):
|
|||||||
"name": title or f"LOGAR Release {tag}",
|
"name": title or f"LOGAR Release {tag}",
|
||||||
"body": notes or f"Automated binary release for {tag}.",
|
"body": notes or f"Automated binary release for {tag}.",
|
||||||
"draft": False,
|
"draft": False,
|
||||||
"prerelease": False
|
"prerelease": is_prerelease
|
||||||
}
|
}
|
||||||
req = urllib.request.Request(url, data=json.dumps(payload).encode("utf-8"), headers=headers, method="POST")
|
req = urllib.request.Request(url, data=json.dumps(payload).encode("utf-8"), headers=headers, method="POST")
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import re
|
|||||||
from typing import Tuple, Optional
|
from typing import Tuple, Optional
|
||||||
|
|
||||||
|
|
||||||
LOGAR_VERSION = "0.3.5.2"
|
LOGAR_VERSION = "0.3.6.0-rc1"
|
||||||
__version__ = LOGAR_VERSION
|
__version__ = LOGAR_VERSION
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user