no sid only golang

This commit is contained in:
Iain Learmonth 2026-05-17 16:45:58 +01:00
parent 57c519436e
commit 2b4ee30cce
15 changed files with 58 additions and 596 deletions

View file

@ -1,37 +1,24 @@
import requests, os, sys
import urllib.request
import json
def git(command):
return os.system(f"git {command}")
# 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}")
release = requests.get("https://api.github.com/repos/protonmail/proton-bridge/releases/latest").json()
version = release['tag_name']
deb = [asset for asset in release ['assets'] if asset['name'].endswith('.deb')][0]['browser_download_url']
with open("VERSION", 'r') as f:
current_version = f.read()
print(f"Latest release is: {version}")
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.")
with open("VERSION", 'w') as f:
f.write(version)
with open("deb/PACKAGE", 'w') as f:
f.write(deb)
git("config --local user.name 'GitHub Actions'")
git("config --local user.email 'actions@github.com'")
git("add -A")
if git("diff --cached --quiet") == 0: # Returns 0 if there are no changes
print("Version didn't change")
exit(0)
git(f"commit -m 'Bump version to {version}'")
is_pull_request = sys.argv[1] == "true"
if is_pull_request:
print("This is a pull request, skipping push step.")
exit(0)
if git("push") != 0:
print("Git push failed!")
exit(1)