77 lines
3.4 KiB
Python
Executable File
77 lines
3.4 KiB
Python
Executable File
import urllib.request
|
|
import json
|
|
import os
|
|
import subprocess
|
|
import shutil
|
|
|
|
token = "e3b515eaa0a6683c921ca3bf718e281ed30a6075"
|
|
owner_repo = "sanjeok77/ShiftRing"
|
|
tag = "v1.1.5"
|
|
title = "v1.1.5 - 근무 변경 모달 팝업 버튼 겹침 현상 완벽 수정 및 업데이트 정보 자동 기입 동기화"
|
|
body = """## 🚀 ShiftRing v1.1.5 릴리즈
|
|
|
|
### 🌟 주요 변경 및 개선 사항
|
|
1. **🔘 근무 변경 팝업 버튼 겹침 현상 완벽 수정 (`dialog_day_settings.xml`)**:
|
|
- ConstraintLayout Flow 제약조건 충돌을 제거하고 3행 리니어 그리드 구조로 전면 재구축하여 '주간' 앞에 버튼들이 뭉치거나 겹치지 않고 완벽한 균등 정렬로 표시되도록 수정
|
|
2. **🔄 업데이트 내역(CHANGELOG.md) 자동 기입 및 실시간 동기화 (`CHANGELOG.md`, `NoticeActivity.kt`)**:
|
|
- v1.1.4 및 v1.1.5를 포함한 모든 최신 릴리즈 내역을 체인지로그에 누락 없이 동기화하고 최대 15개 항목까지 쾌적하게 열람 가능하도록 개선"""
|
|
|
|
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('utf-8')
|
|
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": 115,
|
|
"versionName": "1.1.5",
|
|
"apkUrl": direct_url,
|
|
"changelog": "v1.1.5: 근무 변경 팝업 버튼 겹침 수정, 업데이트 내역 자동 기입 및 실시간 동기화",
|
|
"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}")
|
|
|
|
# Git commit and push cleanly in UTF-8
|
|
git_path = r"C:\Users\work\AppData\Roaming\MobaXterm\slash\mx86_64b\bin"
|
|
os.environ["PATH"] = git_path + os.pathsep + os.environ.get("PATH", "")
|
|
|
|
commit_msg = "v1.1.5 - 근무 변경 모달 팝업 버튼 겹침 현상 완벽 수정 및 업데이트 정보 자동 기입 동기화"
|
|
subprocess.run(["git", "add", "."], check=True)
|
|
subprocess.run(["git", "commit", "-m", commit_msg], check=True)
|
|
subprocess.run(["git", "push", "origin", "main"], check=True)
|
|
|
|
print("Git commit and push completed successfully!")
|
|
print(f"Release {tag} process finished!")
|