import urllib.request import json import os import subprocess import shutil token = "e3b515eaa0a6683c921ca3bf718e281ed30a6075" owner_repo = "sanjeok77/ShiftRing" tag = "v1.0.3" title = "v1.0.3 - 하루 메모 4줄 확장 & 날짜 옆 근무 뱃지 배치 및 알람 추가 시 볼륨 최대치 보정" body = """## 🚀 ShiftRing v1.0.3 릴리즈 ### 🌟 주요 변경 및 개선 사항 1. **하루 메모 4줄 확장 및 날짜 옆 근무 뱃지 직관 배치**: - 메모가 작성된 날짜의 경우 기존 중앙 큰 동그라미 대신 **날짜 숫자 바로 옆에 미니멀한 근무 뱃지(주/석/야/휴 등)**를 컴팩트하게 표시 - 달력 셀 중앙 영역을 메모 텍스트에 온전히 할애하여 **최대 4줄까지 메모 내용이 깔끔하게 표시**되도록 가독성 대폭 향상 - 메모가 없는 날짜는 기존대로 중앙에 크고 또렷한 20sp 근무 원형 표시 유지 2. **알람 추가 시 시스템 알람 스트림 볼륨 최대치 자동 보정**: - 새 알람 추가 또는 알람 스트림 볼륨이 0(무음)으로 되어 있는 경우, 시스템 알람 볼륨(`STREAM_ALARM`)을 자동으로 최대치로 설정하여 소리가 안 나는 현상 방지 3. **Android 14/15 호환 및 정식 서명키(release.jks) 적용**""" apk_path = "app/build/outputs/apk/release/app-release.apk" if not os.path.exists(apk_path): print(f"APK not found at {apk_path}") exit(1) print(f"Using APK at: {apk_path}") # Create Gitea Release url = f"https://git.webpluss.net/api/v1/repos/{owner_repo}/releases" headers = {"Authorization": f"token {token}", "Content-Type": "application/json"} data = json.dumps({"tag_name": tag, "name": title, "body": body, "draft": False, "prerelease": False}).encode() req = urllib.request.Request(url, data=data, headers=headers, method="POST") with urllib.request.urlopen(req) as response: result = json.loads(response.read()) release_id = result["id"] print(f"Created Gitea Release successfully. Release ID: {release_id}") # Upload APK asset upload_url = f"https://git.webpluss.net/api/v1/repos/{owner_repo}/releases/{release_id}/assets" print(f"Uploading APK to {upload_url}...") curl_cmd = f'curl -s -X POST "{upload_url}?name=app.apk" -H "Authorization: token {token}" -F "attachment=@{apk_path}"' upload_result = subprocess.run(curl_cmd, shell=True, capture_output=True, text=True) print(f"Upload output: {upload_result.stdout}") upload_json = json.loads(upload_result.stdout) apk_uuid = upload_json.get("uuid") direct_url = upload_json.get("browser_download_url", f"https://git.webpluss.net/attachments/{apk_uuid}") # Copy APK to project root shutil.copy2(apk_path, "app.apk") print("Updated app.apk at project root.") # Update version.json v_info = { "versionCode": 103, "versionName": "1.0.3", "apkUrl": direct_url, "changelog": "v1.0.3: 하루 메모 4줄 확장 & 날짜 옆 근무 뱃지 배치, 알람 추가 시 볼륨 최대치 자동 보정", "forceUpdate": False } with open("version.json", "w", encoding="utf-8") as f: json.dump(v_info, f, ensure_ascii=False, indent=2) print(f"Updated version.json with apkUrl: {direct_url}") print(f"Release {tag} process finished!")