protonmail-bridge-docker/update-check.py
2026-05-17 16:45:58 +01:00

24 lines
685 B
Python

import urllib.request
import json
# Fetch latest release from GitHub API
req = urllib.request.Request(
"https://api.github.com/repos/protonmail/proton-bridge/releases/latest",
headers={"Accept": "application/vnd.github.v3+json"}
)
with urllib.request.urlopen(req) as response:
release = json.loads(response.read().decode())
latest_version = release['tag_name']
print(f"Latest release is: {latest_version}")
with open("VERSION", 'r') as f:
current_version = f.read()
if latest_version != current_version:
print(f"Updating from {current_version}...")
with open("VERSION", 'w') as f:
f.write(latest_version)
else:
print("Already up to date.")