From c2f69124b2c6ce85360af93c5fab6e0149a2018e Mon Sep 17 00:00:00 2001 From: Cai <62058454+ACaiCat@users.noreply.github.com> Date: Fri, 30 Aug 2024 21:27:21 +0800 Subject: [PATCH 1/3] Update plugins_publish.yml --- .github/workflows/plugins_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/plugins_publish.yml b/.github/workflows/plugins_publish.yml index daf2623e..bfd937d0 100644 --- a/.github/workflows/plugins_publish.yml +++ b/.github/workflows/plugins_publish.yml @@ -87,7 +87,7 @@ jobs: - name: 打包 run: - sudo python BuildHelper.py Release + sudo python BuildHelper.py Release ${{ secrets.CAI_GITEE_TOKEN }} env: PYTHONIOENCODING: 'utf-8' From 445ff53ac523e5aa60f8df6c816a02e8ada092dc Mon Sep 17 00:00:00 2001 From: Cai <62058454+ACaiCat@users.noreply.github.com> Date: Fri, 30 Aug 2024 21:32:27 +0800 Subject: [PATCH 2/3] Update BuildHelper.py --- BuildHelper.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/BuildHelper.py b/BuildHelper.py index c28db762..15897e0d 100644 --- a/BuildHelper.py +++ b/BuildHelper.py @@ -63,4 +63,21 @@ def zip_files_in_folder(folder_path, zip_file_path): print("📦 准备打包插件...") zip_files_in_folder(f"out/{build_type}", "Plugins.zip") - print("🎉 插件打包成功!") + print("📦 插件打包成功!") + + print("✨ 准备更新Gitee插件包...") + gitee_token = sys.argv[2] + headers = { + 'Authorization': f'token {gitee_token}' + } + files = { + 'file': open('Plugins.zip', 'rb') + } + response = requests.post("https://gitee.com/api/v5/repos/kksjsj/TShockPlugin/releases/431070/attach_files", headers=headers, files=files) + if response.status_code == 201: + print('✨Gitee插件包上传成功!') + print('下载链接:', response.json()['browser_download_url']) + else: + print('❓Gitee插件包上传失败:', response.status_code) + print(response.json()) + From fd8ad3910a2c577e4ebdf1bce0185077e36f972f Mon Sep 17 00:00:00 2001 From: Cai <62058454+ACaiCat@users.noreply.github.com> Date: Fri, 30 Aug 2024 21:37:05 +0800 Subject: [PATCH 3/3] Update BuildHelper.py --- BuildHelper.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/BuildHelper.py b/BuildHelper.py index 15897e0d..98e75167 100644 --- a/BuildHelper.py +++ b/BuildHelper.py @@ -64,20 +64,20 @@ def zip_files_in_folder(folder_path, zip_file_path): print("📦 准备打包插件...") zip_files_in_folder(f"out/{build_type}", "Plugins.zip") print("📦 插件打包成功!") - - print("✨ 准备更新Gitee插件包...") - gitee_token = sys.argv[2] - headers = { - 'Authorization': f'token {gitee_token}' - } - files = { - 'file': open('Plugins.zip', 'rb') - } - response = requests.post("https://gitee.com/api/v5/repos/kksjsj/TShockPlugin/releases/431070/attach_files", headers=headers, files=files) - if response.status_code == 201: - print('✨Gitee插件包上传成功!') - print('下载链接:', response.json()['browser_download_url']) - else: - print('❓Gitee插件包上传失败:', response.status_code) - print(response.json()) + if build_type == "Release": + print("✨ 准备更新Gitee插件包...") + gitee_token = sys.argv[2] + headers = { + 'Authorization': f'token {gitee_token}' + } + files = { + 'file': open('Plugins.zip', 'rb') + } + response = requests.post("https://gitee.com/api/v5/repos/kksjsj/TShockPlugin/releases/431070/attach_files", headers=headers, files=files) + if response.status_code == 201: + print('✨Gitee插件包上传成功!') + print('下载链接:', response.json()['browser_download_url']) + else: + print('❓Gitee插件包上传失败:', response.status_code) + print(response.json())