Update branch reference from release to main for version checks and updates

This commit is contained in:
2026-01-20 16:50:42 +01:00
parent 4cb3c001d0
commit c8a1d4788f
2 changed files with 16 additions and 20 deletions

View File

@@ -24,7 +24,7 @@ from auracast.utils.frontend_auth import (
_THIS_DIR = os.path.dirname(__file__)
_FAVICON_PATH = os.path.abspath(os.path.join(_THIS_DIR, '..', 'utils', 'favicon.ico'))
favicon = Image.open(_FAVICON_PATH)
st.set_page_config(page_title="Castbox", page_icon=favicon, layout="centered")
st.set_page_config(page_title="Beacon", page_icon=favicon, layout="centered")
# Load environment variables from a .env file if present
load_dotenv()

View File

@@ -1121,14 +1121,14 @@ async def get_version():
@app.get("/check_update")
async def check_update():
"""Check for available updates by comparing current version with latest release tag."""
"""Check for available updates by comparing current version with latest tag on main branch."""
try:
# server -> auracast -> src -> bumble-auracast (3 levels up)
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
# Fetch all tags and refs from origin
# Fetch tags and main branch from origin
proc = await asyncio.create_subprocess_exec(
"git", "fetch", "--tags", "--force", "origin",
"git", "fetch", "--tags", "origin", "main",
cwd=project_root,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE
@@ -1137,24 +1137,20 @@ async def check_update():
if proc.returncode != 0:
log.warning("git fetch failed: %s", stderr.decode())
# Get the latest tag sorted by version (semver-like sorting)
# This gets all tags, sorts them by version, and takes the last one
# Get the latest tag reachable from main branch
proc = await asyncio.create_subprocess_exec(
"git", "tag", "--sort=version:refname",
"git", "describe", "--tags", "--abbrev=0", "origin/main",
cwd=project_root,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await proc.communicate()
if proc.returncode != 0:
return {"available": None, "error": f"Could not list tags: {stderr.decode()}"}
return {"available": None, "error": f"No tags found on main branch: {stderr.decode()}"}
tags = stdout.decode().strip().split('\n')
tags = [t for t in tags if t] # Filter empty strings
if not tags:
return {"available": None, "error": "No tags found in repository"}
latest_tag = tags[-1] # Last tag after version sorting
latest_tag = stdout.decode().strip()
if not latest_tag:
return {"available": None, "error": "No tags found on main branch"}
# Get current version
current_version = (await get_version()).get("version", "unknown")
@@ -1172,7 +1168,7 @@ async def check_update():
@app.post("/system_update")
async def system_update():
"""Update application: git pull release branch (latest tag), poetry install, restart services."""
"""Update application: git pull main branch (latest tag), poetry install, restart services."""
try:
# Best-effort: stop any active streaming cleanly
try:
@@ -1183,10 +1179,10 @@ async def system_update():
# server -> auracast -> src -> bumble-auracast (3 levels up)
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
# 1. Fetch and checkout the latest tag from the release branch
# First fetch all tags and the release branch
# 1. Fetch and checkout the latest tag from the main branch
# First fetch all tags and the main branch
proc = await asyncio.create_subprocess_exec(
"git", "fetch", "--tags", "origin", "release",
"git", "fetch", "--tags", "origin", "main",
cwd=project_root,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE
@@ -1196,9 +1192,9 @@ async def system_update():
log.error("git fetch failed: %s", stderr.decode())
raise HTTPException(status_code=500, detail=f"git fetch failed: {stderr.decode()}")
# Get the latest tag on the release branch
# Get the latest tag on the main branch
proc = await asyncio.create_subprocess_exec(
"git", "describe", "--tags", "--abbrev=0", "origin/release",
"git", "describe", "--tags", "--abbrev=0", "origin/main",
cwd=project_root,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE