diff --git a/.gitignore b/.gitignore index 7887cbc3..6530e900 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ 1.py __pycache__ *.xml -config.yaml \ No newline at end of file +config.yaml +*.pyc \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 5c7df64a..f614af3d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,16 +9,18 @@ "type": "debugpy", "request": "launch", "env": { - // "DB":"sqlite:///db.db", + "DB":"sqlite:///db.db", // "DB":"mysql+pymysql://we-rss:123456@119.3.239.67/we-rss", "PORT": "8080", "USERNAME":"admin", "PASSWORD":"admin@123", + "DEBUG": "True", // "DINGDING_WEBHOOK":"https://oapi.dingtalk.com/robot/send?access_token=67933f7b759241a79c122f42d02a627f4457c0b40603ddf3b4711e88e859d072" - "DINGDING_WEBHOOK":"https://oapi.dingtalk.com/robot/send?access_token=af7f99c32895f79d9d61c57181f164b77027102a22f3b205dc15e2984690025c" + // "DINGDING_WEBHOOK":"https://oapi.dingtalk.com/robot/send?access_token=af7f99c32895f79d9d61c57181f164b77027102a22f3b205dc15e2984690025c" + "DINGDING_WEBHOOK":"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a7240ff8-2d2e-48b3-b02a-c6a37fee69f7" }, - "program": "main.py", - // "program": "job.py", + // "program": "main.py", + "program": "job.py", "args": ["-init", "True","-job","False"] } ] diff --git a/app.log b/app.log index 5b92b5cd..ede2e369 100644 --- a/app.log +++ b/app.log @@ -509,3 +509,67 @@ 2025-05-27 22:57:25 - core.log - INFO - 中国妇女报 更新结束,共更新0 2025-05-27 22:57:26 - core.log - INFO - 长沙发布 更新结束,共更新0 2025-05-27 22:57:26 - core.log - INFO - 所有公众号更新完成,共更新0条数据 +2025-05-28 11:41:33 - core.log - INFO - 扫描全能王 更新结束,共更新0 +2025-05-28 11:41:34 - core.log - INFO - 中关村论坛 更新结束,共更新0 +2025-05-28 11:41:35 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新0 +2025-05-28 11:41:36 - core.log - INFO - 中国妇女报 更新结束,共更新3 +2025-05-28 11:41:37 - core.log - INFO - 长沙发布 更新结束,共更新4 +2025-05-28 11:41:37 - core.log - INFO - 所有公众号更新完成,共更新7条数据 +2025-05-28 11:42:11 - core.log - INFO - 扫描全能王 更新结束,共更新0 +2025-05-28 11:42:12 - core.log - INFO - 中关村论坛 更新结束,共更新0 +2025-05-28 11:42:13 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新0 +2025-05-28 11:42:14 - core.log - INFO - 中国妇女报 更新结束,共更新0 +2025-05-28 11:42:14 - core.log - INFO - 长沙发布 更新结束,共更新0 +2025-05-28 11:42:14 - core.log - INFO - 所有公众号更新完成,共更新0条数据 +2025-05-28 12:32:36 - core.log - INFO - 扫描全能王 更新结束,共更新0 +2025-05-28 12:32:36 - core.log - INFO - 中关村论坛 更新结束,共更新0 +2025-05-28 12:32:36 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新0 +2025-05-28 12:32:36 - core.log - INFO - 中国妇女报 更新结束,共更新0 +2025-05-28 12:32:36 - core.log - INFO - 长沙发布 更新结束,共更新0 +2025-05-28 12:32:36 - core.log - INFO - 所有公众号更新完成,共更新0条数据 +2025-05-28 12:33:27 - core.log - INFO - 扫描全能王 更新结束,共更新10 +2025-05-28 12:33:28 - core.log - INFO - 中关村论坛 更新结束,共更新10 +2025-05-28 12:33:29 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10 +2025-05-28 12:33:30 - core.log - INFO - 中国妇女报 更新结束,共更新10 +2025-05-28 12:33:31 - core.log - INFO - 长沙发布 更新结束,共更新10 +2025-05-28 12:33:31 - core.log - INFO - 所有公众号更新完成,共更新50条数据 +2025-05-28 12:48:25 - core.log - INFO - 扫描全能王 更新结束,共更新10 +2025-05-28 12:48:27 - core.log - INFO - 中关村论坛 更新结束,共更新10 +2025-05-28 12:48:28 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10 +2025-05-28 12:48:29 - core.log - INFO - 中国妇女报 更新结束,共更新10 +2025-05-28 12:50:10 - core.log - INFO - 扫描全能王 更新结束,共更新10 +2025-05-28 12:50:11 - core.log - INFO - 中关村论坛 更新结束,共更新10 +2025-05-28 12:50:12 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10 +2025-05-28 12:50:13 - core.log - INFO - 中国妇女报 更新结束,共更新10 +2025-05-28 12:50:14 - core.log - INFO - 长沙发布 更新结束,共更新10 +2025-05-28 12:50:14 - core.log - INFO - 所有公众号更新完成,共更新50条数据 +2025-05-28 12:53:07 - core.log - INFO - 扫描全能王 更新结束,共更新10 +2025-05-28 12:53:08 - core.log - INFO - 中关村论坛 更新结束,共更新10 +2025-05-28 12:53:09 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10 +2025-05-28 12:53:10 - core.log - INFO - 中国妇女报 更新结束,共更新10 +2025-05-28 12:53:11 - core.log - INFO - 长沙发布 更新结束,共更新10 +2025-05-28 12:53:11 - core.log - INFO - 所有公众号更新完成,共更新50条数据 +2025-05-28 12:53:48 - core.log - INFO - 扫描全能王 更新结束,共更新10 +2025-05-28 12:53:49 - core.log - INFO - 中关村论坛 更新结束,共更新10 +2025-05-28 12:53:50 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10 +2025-05-28 12:53:52 - core.log - INFO - 中国妇女报 更新结束,共更新10 +2025-05-28 12:53:53 - core.log - INFO - 长沙发布 更新结束,共更新10 +2025-05-28 12:53:53 - core.log - INFO - 所有公众号更新完成,共更新50条数据 +2025-05-28 12:54:15 - core.log - INFO - 扫描全能王 更新结束,共更新10 +2025-05-28 12:54:16 - core.log - INFO - 中关村论坛 更新结束,共更新10 +2025-05-28 12:54:18 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10 +2025-05-28 12:54:19 - core.log - INFO - 中国妇女报 更新结束,共更新10 +2025-05-28 12:54:20 - core.log - INFO - 长沙发布 更新结束,共更新10 +2025-05-28 12:54:20 - core.log - INFO - 所有公众号更新完成,共更新50条数据 +2025-05-28 12:55:49 - core.log - INFO - 扫描全能王 更新结束,共更新10 +2025-05-28 12:55:50 - core.log - INFO - 中关村论坛 更新结束,共更新10 +2025-05-28 12:55:51 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10 +2025-05-28 12:55:52 - core.log - INFO - 中国妇女报 更新结束,共更新10 +2025-05-28 12:55:53 - core.log - INFO - 长沙发布 更新结束,共更新10 +2025-05-28 12:55:53 - core.log - INFO - 所有公众号更新完成,共更新50条数据 +2025-05-28 12:56:16 - core.log - INFO - 扫描全能王 更新结束,共更新10 +2025-05-28 12:56:17 - core.log - INFO - 中关村论坛 更新结束,共更新10 +2025-05-28 12:56:18 - core.log - INFO - 中国北京同仁堂官微 更新结束,共更新10 +2025-05-28 12:56:19 - core.log - INFO - 中国妇女报 更新结束,共更新10 +2025-05-28 12:56:20 - core.log - INFO - 长沙发布 更新结束,共更新10 +2025-05-28 12:56:20 - core.log - INFO - 所有公众号更新完成,共更新50条数据 diff --git a/config.example.yaml b/config.example.yaml index 732bfa8c..83d32b18 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -13,4 +13,7 @@ token: user_agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.39... #瀹氭椂浠诲姟鎵ц闂撮殧鏃堕棿 鍗曚綅绉 榛樿300s -interval: ${INTERVAL:- 300} \ No newline at end of file +interval: ${INTERVAL:- 300} + +#璋冭瘯妯″紡 +debug: ${DEBUG:-False} \ No newline at end of file diff --git a/core/config.py b/core/config.py index b6efe006..766733e2 100644 --- a/core/config.py +++ b/core/config.py @@ -66,5 +66,5 @@ cfg=Config() config = cfg.get_config() DEBUG=cfg.get("debug",False) APP_NAME=cfg.get("app_name","we-mp-rss") -from ver import VERSION +from core.ver import VERSION print(VERSION) \ No newline at end of file diff --git a/core/notice/__init__.py b/core/notice/__init__.py new file mode 100644 index 00000000..852f35e1 --- /dev/null +++ b/core/notice/__init__.py @@ -0,0 +1,28 @@ +from .wechat import send_wechat_message +from .dingtalk import send_dingtalk_message + +def notice( webhook_url, title, text,notice_type: str=None): + """ + 鍏敤閫氱煡鏂规硶锛屾牴鎹被鍨嬪垽鏂皟鐢ㄥ摢绉嶉氱煡 + + 鍙傛暟: + - notice_type: 閫氱煡绫诲瀷锛'wechat' 鎴 'dingtalk' + - webhook_url: 瀵瑰簲鏈哄櫒浜虹殑Webhook鍦板潃 + - title: 娑堟伅鏍囬 + - text: 娑堟伅鍐呭 + """ + if 'qyapi.weixin.qq.com' in webhook_url: + notice_type = 'wechat' + elif 'oapi.dingtalk.com' in webhook_url: + notice_type = 'dingtalk' + else: + print('鏃犳硶鏍规嵁 webhook_url 璇嗗埆閫氱煡绫诲瀷') + return + + if notice_type == 'wechat': + + send_wechat_message(webhook_url, title, text) + elif notice_type == 'dingtalk': + send_dingtalk_message(webhook_url, title, text) + else: + print('涓嶆敮鎸佺殑閫氱煡绫诲瀷') \ No newline at end of file diff --git a/core/notice.py b/core/notice/dingtalk.py similarity index 93% rename from core/notice.py rename to core/notice/dingtalk.py index b7f235a1..ef7a5a54 100644 --- a/core/notice.py +++ b/core/notice/dingtalk.py @@ -1,6 +1,6 @@ import requests import json -def send_dingtalk_markdown(webhook_url, title, text, is_at_all=False, at_mobiles=[]): +def send_dingtalk_message(webhook_url, title, text, is_at_all=False, at_mobiles=[]): """ 鍙戦丮arkdown鏍煎紡娑堟伅 diff --git a/core/notice/wechat.py b/core/notice/wechat.py new file mode 100644 index 00000000..f20b89b8 --- /dev/null +++ b/core/notice/wechat.py @@ -0,0 +1,31 @@ +import requests +import json + + +def send_wechat_message(webhook_url, title, text): + """ + 鍙戦佸井淇℃秷鎭 + + 鍙傛暟: + - webhook_url: 寰俊鏈哄櫒浜篧ebhook鍦板潃 + - title: 娑堟伅鏍囬 + - text: 娑堟伅鍐呭 + """ + # 鎴彇 text 纭繚瀛楃鏁颁笉瓒呰繃 4096 涓 + text = text[:2048] + headers = {'Content-Type': 'application/json'} + data = { + "msgtype": "markdown", + "markdown": { + "content": f"{text}" + } + } + try: + response = requests.post( + url=webhook_url, + headers=headers, + data=json.dumps(data) + ) + print(response.text) + except Exception as e: + print('寰俊閫氱煡鍙戦佸け璐', e) \ No newline at end of file diff --git a/db.db b/db.db index 237f230d..4d525628 100644 Binary files a/db.db and b/db.db differ diff --git a/docs/versions/1.3.2 b/docs/versions/1.3.2 new file mode 100644 index 00000000..71c99793 --- /dev/null +++ b/docs/versions/1.3.2 @@ -0,0 +1,3 @@ +# 閫氱煡璋冩暣 +- 澧炲姞寰俊閫氱煡 +- 浼樺寲閫氱煡鏈哄埗 \ No newline at end of file diff --git a/job.py b/job.py index 3e98b34f..adb36078 100644 --- a/job.py +++ b/job.py @@ -2,7 +2,7 @@ import schedule, time import core.wx as wx import core.db as db from core.config import DEBUG,cfg -import core.notice as notice + import random import core.log as log from datetime import datetime @@ -35,15 +35,15 @@ def do_job(): faker_id=item.faker_id mp_id=item.id print(f'姝e湪鏇存柊鍏紬鍙凤細{item.mp_name}({item.id})') - if not DEBUG: # 鑾峰彇瀵瑰簲鍏紬鍙峰垪琛 - data=wx.get_list(faker_id,mp_id,0) - for art in data: - # 娣诲姞鍒版暟鎹簱 - # delete_article(art['id']) - if wx_db.add_article(art): - mps_count=mps_count+1 - text_list+=f"{mps_count}. [{art['title']}](https://mp.weixin.qq.com/s/{art['id']})[{art['created_at']}]\n" + data=wx.get_list(faker_id,mp_id,0) + for art in data: + # 娣诲姞鍒版暟鎹簱 + if DEBUG: + delete_article(art['id']) + if wx_db.add_article(art): + mps_count=mps_count+1 + text_list+=f"{mps_count}. [{art['title']}](https://mp.weixin.qq.com/s/{art['id']})[{art['created_at']}]\n" else: print("璋冭瘯妯″紡锛屼笉杩涜鏇存柊") @@ -68,11 +68,11 @@ def start(): time.sleep(10) def send_notice(text:str="",title:str=""): - markdown_text = f"""### {title} 閫氱煡 - {text} - """ - webhook=cfg.get('notice')['dingding'] - notice.send_dingtalk_markdown(webhook, title, markdown_text) + markdown_text = f"### {title} 閫氱煡\n{text}" + webhook = cfg.get('notice')['dingding'] + # 淇鍙傛暟椤哄簭 + from core.notice import notice + notice(webhook, title, markdown_text) if __name__ == '__main__': do_job() \ No newline at end of file diff --git a/latest_openapi.json b/latest_openapi.json deleted file mode 100644 index 1e49db50..00000000 --- a/latest_openapi.json +++ /dev/null @@ -1 +0,0 @@ -{"openapi":"3.1.0","info":{"title":"WeRSS API","description":"寰俊鍏紬鍙稲SS鐢熸垚鏈嶅姟API鏂囨。","version":"1.0.0"},"paths":{"/api/v1/wx/auth/login":{"post":{"tags":["璁よ瘉"],"summary":"鐢ㄦ埛鐧诲綍","operationId":"login_api_v1_wx_auth_login_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_login_api_v1_wx_auth_login_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/wx/auth/logout":{"post":{"tags":["璁よ瘉"],"summary":"鐢ㄦ埛娉ㄩ攢","operationId":"logout_api_v1_wx_auth_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/v1/wx/auth/refresh":{"post":{"tags":["璁よ瘉"],"summary":"鍒锋柊Token","operationId":"refresh_token_api_v1_wx_auth_refresh_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/v1/wx/auth/verify":{"get":{"tags":["璁よ瘉"],"summary":"楠岃瘉Token鏈夋晥鎬","description":"楠岃瘉褰撳墠token鏄惁鏈夋晥","operationId":"verify_token_api_v1_wx_auth_verify_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/v1/wx/user":{"get":{"tags":["鐢ㄦ埛绠$悊"],"summary":"鑾峰彇鐢ㄦ埛淇℃伅","operationId":"get_user_info_api_v1_wx_user_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]}]},"put":{"tags":["鐢ㄦ埛绠$悊"],"summary":"淇敼鐢ㄦ埛璧勬枡","description":"淇敼鐢ㄦ埛鍩烘湰淇℃伅(涓嶅寘鎷瘑鐮)","operationId":"update_user_info_api_v1_wx_user_put","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Update Data"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/v1/wx/user/password":{"put":{"tags":["鐢ㄦ埛绠$悊"],"summary":"淇敼瀵嗙爜","description":"淇敼鐢ㄦ埛瀵嗙爜","operationId":"change_password_api_v1_wx_user_password_put","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Password Data"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/v1/wx/user/avatar":{"post":{"tags":["鐢ㄦ埛绠$悊"],"summary":"涓婁紶鐢ㄦ埛澶村儚","description":"澶勭悊鐢ㄦ埛澶村儚涓婁紶","operationId":"upload_avatar_api_v1_wx_user_avatar_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_avatar_api_v1_wx_user_avatar_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/v1/wx/articles":{"get":{"tags":["鏂囩珷绠$悊"],"summary":"鑾峰彇鏂囩珷鍒楄〃","operationId":"get_articles_api_v1_wx_articles_get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/wx/articles/{article_id}":{"get":{"tags":["鏂囩珷绠$悊"],"summary":"鑾峰彇鏂囩珷璇︽儏","operationId":"get_article_detail_api_v1_wx_articles__article_id__get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"article_id","in":"path","required":true,"schema":{"type":"integer","title":"Article Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/wx/mps":{"get":{"tags":["鍏紬鍙风鐞"],"summary":"鑾峰彇鍏紬鍙峰垪琛","operationId":"get_mps_api_v1_wx_mps_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearer":[]}]}},"/api/v1/wx/mps/{mp_id}":{"get":{"tags":["鍏紬鍙风鐞"],"summary":"鑾峰彇鍏紬鍙疯鎯","operationId":"get_mp_detail_api_v1_wx_mps__mp_id__get","security":[{"OAuth2PasswordBearer":[]}],"parameters":[{"name":"mp_id","in":"path","required":true,"schema":{"type":"string","title":"Mp Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/{path}":{"get":{"summary":"Serve Vue App","description":"澶勭悊Vue搴旂敤璺敱","operationId":"serve_vue_app__path__get","parameters":[{"name":"path","in":"path","required":true,"schema":{"type":"string","title":"Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"summary":"Serve Root","description":"澶勭悊鏍硅矾鐢","operationId":"serve_root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"Body_login_api_v1_wx_auth_login_post":{"properties":{"grant_type":{"anyOf":[{"type":"string","pattern":"^password$"},{"type":"null"}],"title":"Grant Type"},"username":{"type":"string","title":"Username"},"password":{"type":"string","title":"Password"},"scope":{"type":"string","title":"Scope","default":""},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"client_secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Secret"}},"type":"object","required":["username","password"],"title":"Body_login_api_v1_wx_auth_login_post"},"Body_upload_avatar_api_v1_wx_user_avatar_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_avatar_api_v1_wx_user_avatar_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}}}} \ No newline at end of file diff --git a/publish.bat b/publish.bat index fb924589..d4890d95 100644 --- a/publish.bat +++ b/publish.bat @@ -4,8 +4,27 @@ REM 璇诲彇Python閰嶇疆鏂囦欢涓殑鐗堟湰鍙 for /f "tokens=1 delims==" %%v in ('python -c "from core.ver import VERSION; print(VERSION)"') do set VERSION=%%v set tag="v%VERSION%" echo 褰撳墠鐗堟湰: %VERSION% TAG: %tag% + +set comment="%1" +set version_file="docs/versions/%VERSION%" +if exist %version_file% ( + setlocal enabledelayedexpansion + set "comment="" + for /f "usebackq delims=" %%a in (%version_file%) do ( + if defined comment ( + set "comment=!comment!\n%%a" + ) else ( + set "comment=%%a" + ) + ) + endlocal & set "comment=%comment%" +) else ( + echo 璀﹀憡锛氭湭鎵惧埌瀵瑰簲鐗堟湰鍙风殑鏂囦欢 %version_file% +) +echo %comment% +pause git add . -git tag "v%VERSION%" -m "%1" -git commit -m %VERSION% +git tag "v%VERSION%" -m "%comment%" +git commit -m "%comment%" git push -u origin main git push origin %tag% \ No newline at end of file