From 8e00676fafc88bba3856f62ffbda4e1c4740d2cc Mon Sep 17 00:00:00 2001 From: DLmaster Date: Mon, 17 Feb 2025 14:20:23 +0800 Subject: [PATCH 1/7] =?UTF-8?q?ci(build):=20=E6=B5=8B=E8=AF=95=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E4=B8=8A=E4=BC=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-pre.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-pre.yml b/.github/workflows/build-pre.yml index 8e20581..a68d3ed 100644 --- a/.github/workflows/build-pre.yml +++ b/.github/workflows/build-pre.yml @@ -150,4 +150,15 @@ jobs: gh release delete "$TAGNAME" --yes gh release create "$TAGNAME" --target "main" --title "$NAME" --notes "$NOTES" --prerelease artifacts/* env: - GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + + - name: Setup SSH Key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts + + - name: Upload Release to Server + run: | + scp -r artifacts/* ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:/home/user/files/AUTO_MAA/ From 2a235b2bc9ba1de99d711f83257bef7fcf33b359 Mon Sep 17 00:00:00 2001 From: DLmaster Date: Mon, 17 Mar 2025 18:52:11 +0800 Subject: [PATCH 2/7] =?UTF-8?q?test(ci):=20=E6=B5=8B=E8=AF=95=E6=96=B0?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app.yml | 15 +++++++++++++++ .github/workflows/build-pre.yml | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index b2f4174..0c82198 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -160,3 +160,18 @@ jobs: - name: Upload Release to Server run: | scp -r artifacts/* ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:/home/user/files/AUTO_MAA/ + - name: Install obsutil + run: | + wget https://obs-community.obs.cn-north-1.myhuaweicloud.com/obsutil/current/obsutil_linux_amd64.tar.gz + tar -xzvf obsutil_linux_amd64.tar.gz --strip-components=1 + chmod 755 obsutil + ./obsutil version + - name: Upload Release to Huawei OBS + env: + OBS_AK: ${{ secrets.OBS_AK }} + OBS_SK: ${{ secrets.OBS_SK }} + OBS_ENDPOINT: ${{ secrets.OBS_ENDPOINT }} + OBS_BUCKET: ${{ secrets.OBS_BUCKET }} + run: | + ./obsutil config -i $OBS_AK -k $OBS_SK -e $OBS_ENDPOINT + ./obsutil cp artifacts/* obs://$OBS_BUCKET/releases/ \ No newline at end of file diff --git a/.github/workflows/build-pre.yml b/.github/workflows/build-pre.yml index 7c5be84..4d5b07b 100644 --- a/.github/workflows/build-pre.yml +++ b/.github/workflows/build-pre.yml @@ -160,3 +160,18 @@ jobs: - name: Upload Release to Server run: | scp -r artifacts/* ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:/home/user/files/AUTO_MAA/ + - name: Install obsutil + run: | + wget https://obs-community.obs.cn-north-1.myhuaweicloud.com/obsutil/current/obsutil_linux_amd64.tar.gz + tar -xzvf obsutil_linux_amd64.tar.gz --strip-components=1 + chmod 755 obsutil + ./obsutil version + - name: Upload Release to Huawei OBS + env: + OBS_AK: ${{ secrets.OBS_AK }} + OBS_SK: ${{ secrets.OBS_SK }} + OBS_ENDPOINT: ${{ secrets.OBS_ENDPOINT }} + OBS_BUCKET: ${{ secrets.OBS_BUCKET }} + run: | + ./obsutil config -i $OBS_AK -k $OBS_SK -e $OBS_ENDPOINT + ./obsutil cp artifacts/* obs://$OBS_BUCKET/releases/ \ No newline at end of file From 67b8725156ecbde86e8390b91433cac80d7254bf Mon Sep 17 00:00:00 2001 From: DLmaster Date: Mon, 17 Mar 2025 20:52:39 +0800 Subject: [PATCH 3/7] =?UTF-8?q?test(ci):=20=E6=B5=8B=E8=AF=95=E6=96=B0?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E7=AB=99-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app.yml | 2 +- .github/workflows/build-pre.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index 0c82198..68a446f 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -174,4 +174,4 @@ jobs: OBS_BUCKET: ${{ secrets.OBS_BUCKET }} run: | ./obsutil config -i $OBS_AK -k $OBS_SK -e $OBS_ENDPOINT - ./obsutil cp artifacts/* obs://$OBS_BUCKET/releases/ \ No newline at end of file + ./obsutil cp artifacts/* obs://$OBS_BUCKET/releases/ -r -f \ No newline at end of file diff --git a/.github/workflows/build-pre.yml b/.github/workflows/build-pre.yml index 4d5b07b..ef02290 100644 --- a/.github/workflows/build-pre.yml +++ b/.github/workflows/build-pre.yml @@ -174,4 +174,4 @@ jobs: OBS_BUCKET: ${{ secrets.OBS_BUCKET }} run: | ./obsutil config -i $OBS_AK -k $OBS_SK -e $OBS_ENDPOINT - ./obsutil cp artifacts/* obs://$OBS_BUCKET/releases/ \ No newline at end of file + ./obsutil cp artifacts/* obs://$OBS_BUCKET/releases/ -r -f \ No newline at end of file From fe26f29f93e9e6d2c79775edaa4d8450b6ca75ee Mon Sep 17 00:00:00 2001 From: DLmaster Date: Mon, 17 Mar 2025 21:06:33 +0800 Subject: [PATCH 4/7] =?UTF-8?q?test(ci):=20=E6=B5=8B=E8=AF=95=E6=96=B0?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E7=AB=99-2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-app.yml | 2 +- .github/workflows/build-pre.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index 68a446f..31d94d7 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -174,4 +174,4 @@ jobs: OBS_BUCKET: ${{ secrets.OBS_BUCKET }} run: | ./obsutil config -i $OBS_AK -k $OBS_SK -e $OBS_ENDPOINT - ./obsutil cp artifacts/* obs://$OBS_BUCKET/releases/ -r -f \ No newline at end of file + ./obsutil cp artifacts/ obs://$OBS_BUCKET/releases/ -r -f \ No newline at end of file diff --git a/.github/workflows/build-pre.yml b/.github/workflows/build-pre.yml index ef02290..09b7551 100644 --- a/.github/workflows/build-pre.yml +++ b/.github/workflows/build-pre.yml @@ -174,4 +174,4 @@ jobs: OBS_BUCKET: ${{ secrets.OBS_BUCKET }} run: | ./obsutil config -i $OBS_AK -k $OBS_SK -e $OBS_ENDPOINT - ./obsutil cp artifacts/* obs://$OBS_BUCKET/releases/ -r -f \ No newline at end of file + ./obsutil cp artifacts/ obs://$OBS_BUCKET/releases/ -r -f \ No newline at end of file From cca1acb6f64939da29c3e80a292cdc40c3d026eb Mon Sep 17 00:00:00 2001 From: Dave-Desktop <134820pt@gamil.com> Date: Fri, 11 Apr 2025 02:12:14 +1000 Subject: [PATCH 5/7] =?UTF-8?q?fix(config):=E4=BF=AE=E5=A4=8D=E7=9B=B8?= =?UTF-8?q?=E5=90=8C=E6=88=98=E6=96=97=E5=85=B3=E5=8D=A1=E7=9A=84=E6=8E=89?= =?UTF-8?q?=E8=90=BD=E7=89=A9=E7=B4=AF=E5=8A=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 113 ++++++++++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 38 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index dd18d58..eb8958a 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -506,45 +506,82 @@ class AppConfig: i += 1 # 掉落统计 - current_stage = None - stage_drops = {} - + # 存储所有关卡的掉落统计 + all_stage_drops = {} + + # 查找所有Fight任务的开始和结束位置 + fight_tasks = [] for i, line in enumerate(logs): - drop_match = re.search(r"([A-Za-z0-9\-]+) 掉落统计:", line) - if drop_match: - # 发现新关卡,保存前一个关卡数据 - if current_stage and stage_drops: - data["drop_statistics"][current_stage] = stage_drops + if "开始任务: Fight" in line: + # 查找对应的任务结束位置 + end_index = -1 + for j in range(i+1, len(logs)): + if "完成任务: Fight" in logs[j]: + end_index = j + break + # 如果遇到新的Fight任务开始,则当前任务没有正常结束 + if j < len(logs) and "开始任务: Fight" in logs[j]: + break + + # 如果找到了结束位置,记录这个任务的范围 + if end_index != -1: + fight_tasks.append((i, end_index)) + + # 处理每个Fight任务 + for start_idx, end_idx in fight_tasks: + # 提取当前任务的日志 + task_logs = logs[start_idx:end_idx+1] + + # 查找任务中的最后一次掉落统计 + last_drop_stats = {} + current_stage = None + + for line in task_logs: + # 匹配掉落统计行,如"1-7 掉落统计:" + drop_match = re.search(r"([A-Za-z0-9\-]+) 掉落统计:", line) + if drop_match: + # 发现新的掉落统计,重置当前关卡的掉落数据 + current_stage = drop_match.group(1) + if current_stage == "WE": + current_stage = "剿灭模式" + last_drop_stats = {} + continue + + # 如果已经找到了关卡,处理掉落物 + if current_stage: + item_match: List[str] = re.findall( + r"^(?!\[)([\u4e00-\u9fa5A-Za-z0-9\-]+)\s*:\s*([\d,]+)(?:\s*\(\+[\d,]+\))?", + line, + re.M, + ) + for item, total in item_match: + # 解析数值时去掉逗号 (如 2,160 -> 2160) + total = int(total.replace(",", "")) - current_stage = drop_match.group(1) - if current_stage == "WE": - current_stage = "剿灭模式" - stage_drops = {} - continue - - if current_stage: - item_match: List[str] = re.findall( - r"^(?!\[)([\u4e00-\u9fa5A-Za-z0-9\-]+)\s*:\s*([\d,]+)(?:\s*\(\+[\d,]+\))?", - line, - re.M, - ) - for item, total in item_match: - # 解析数值时去掉逗号 (如 2,160 -> 2160) - total = int(total.replace(",", "")) - - # 黑名单 - if item not in [ - "当前次数", - "理智", - "最快截图耗时", - "专精等级", - "剩余时间", - ]: - stage_drops[item] = total - - # 处理最后一个关卡的掉落数据 - if current_stage and stage_drops: - data["drop_statistics"][current_stage] = stage_drops + # 黑名单 + if item not in [ + "当前次数", + "理智", + "最快截图耗时", + "专精等级", + "剩余时间", + ]: + last_drop_stats[item] = total + + # 如果任务中有掉落统计,更新总统计 + if current_stage and last_drop_stats: + if current_stage not in all_stage_drops: + all_stage_drops[current_stage] = {} + + # 累加掉落数据 + for item, count in last_drop_stats.items(): + if item in all_stage_drops[current_stage]: + all_stage_drops[current_stage][item] += count + else: + all_stage_drops[current_stage][item] = count + + # 将累加后的掉落数据保存到结果中 + data["drop_statistics"] = all_stage_drops # 保存日志 log_path.parent.mkdir(parents=True, exist_ok=True) @@ -607,7 +644,7 @@ class AppConfig: with logs_path.with_suffix(".json").open("w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=4) - logger.info(f"统计完成:{logs_path.with_suffix(".json")}") + logger.info(f"统计完成:{logs_path.with_suffix('.json')}") return data From c01079af1b802474ec3eed995fee06b52cc57910 Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 11 Apr 2025 09:09:04 +0800 Subject: [PATCH 6/7] ci: add mirrorchyan uploading (#38) * Create mirrorchyan.yml * Merge pull request #1 from MistEO/patch-2 * Update build-app.yml * Update build-pre.yml --- .github/workflows/build-app.yml | 10 ++++++++- .github/workflows/build-pre.yml | 10 ++++++++- .github/workflows/mirrorchyan.yml | 21 +++++++++++++++++++ .../workflows/mirrorchyan_release_note.yml | 19 +++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/mirrorchyan.yml create mode 100644 .github/workflows/mirrorchyan_release_note.yml diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index 31d94d7..10d8671 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -151,6 +151,14 @@ jobs: gh release create "$TAGNAME" --target "main" --title "$NAME" --notes "$NOTES" artifacts/* env: GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + + - name: Trigger MirrorChyanUploading + run: | + gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan + gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_release_note + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Setup SSH Key run: | mkdir -p ~/.ssh @@ -174,4 +182,4 @@ jobs: OBS_BUCKET: ${{ secrets.OBS_BUCKET }} run: | ./obsutil config -i $OBS_AK -k $OBS_SK -e $OBS_ENDPOINT - ./obsutil cp artifacts/ obs://$OBS_BUCKET/releases/ -r -f \ No newline at end of file + ./obsutil cp artifacts/ obs://$OBS_BUCKET/releases/ -r -f diff --git a/.github/workflows/build-pre.yml b/.github/workflows/build-pre.yml index 09b7551..6051cdf 100644 --- a/.github/workflows/build-pre.yml +++ b/.github/workflows/build-pre.yml @@ -151,6 +151,14 @@ jobs: gh release create "$TAGNAME" --target "main" --title "$NAME" --notes "$NOTES" --prerelease artifacts/* env: GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + + - name: Trigger MirrorChyanUploading + run: | + gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan + gh workflow run --repo $GITHUB_REPOSITORY mirrorchyan_release_note + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Setup SSH Key run: | mkdir -p ~/.ssh @@ -174,4 +182,4 @@ jobs: OBS_BUCKET: ${{ secrets.OBS_BUCKET }} run: | ./obsutil config -i $OBS_AK -k $OBS_SK -e $OBS_ENDPOINT - ./obsutil cp artifacts/ obs://$OBS_BUCKET/releases/ -r -f \ No newline at end of file + ./obsutil cp artifacts/ obs://$OBS_BUCKET/releases/ -r -f diff --git a/.github/workflows/mirrorchyan.yml b/.github/workflows/mirrorchyan.yml new file mode 100644 index 0000000..604328c --- /dev/null +++ b/.github/workflows/mirrorchyan.yml @@ -0,0 +1,21 @@ +name: mirrorchyan + +on: + workflow_dispatch: + +jobs: + mirrorchyan: + runs-on: macos-latest + + steps: + - id: uploading + uses: MirrorChyan/uploading-action@v1 + with: + filetype: latest-release + filename: "AUTO_MAA*.zip" + mirrorchyan_rid: AUTO_MAA + + owner: DLmaster361 + repo: AUTO_MAA + github_token: ${{ secrets.GITHUB_TOKEN }} + upload_token: ${{ secrets.MirrorChyanUploadToken }} diff --git a/.github/workflows/mirrorchyan_release_note.yml b/.github/workflows/mirrorchyan_release_note.yml new file mode 100644 index 0000000..deb0274 --- /dev/null +++ b/.github/workflows/mirrorchyan_release_note.yml @@ -0,0 +1,19 @@ +name: mirrorchyan_release_note + +on: + workflow_dispatch: + release: + types: [edited] + +jobs: + mirrorchyan: + runs-on: macos-latest + + steps: + - id: uploading + uses: MirrorChyan/release-note-action@v1 + with: + mirrorchyan_rid: AUTO_MAA + + upload_token: ${{ secrets.MirrorChyanUploadToken }} + github_token: ${{ secrets.GITHUB_TOKEN }} From 2e9ff47dbb0fd3282139e1aacc905892e2bfcbd1 Mon Sep 17 00:00:00 2001 From: aoxuan Date: Fri, 11 Apr 2025 10:18:42 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix(config):=20=E7=A7=BB=E9=99=A4=E4=BA=86?= =?UTF-8?q?=E5=89=BF=E7=81=AD=E6=A8=A1=E5=BC=8F=E7=9A=84=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=E3=80=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=B4=AF=E5=8A=A0=E6=8E=89=E8=90=BD=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index eb8958a..6a4feec 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -542,8 +542,6 @@ class AppConfig: if drop_match: # 发现新的掉落统计,重置当前关卡的掉落数据 current_stage = drop_match.group(1) - if current_stage == "WE": - current_stage = "剿灭模式" last_drop_stats = {} continue @@ -575,10 +573,8 @@ class AppConfig: # 累加掉落数据 for item, count in last_drop_stats.items(): - if item in all_stage_drops[current_stage]: - all_stage_drops[current_stage][item] += count - else: - all_stage_drops[current_stage][item] = count + all_stage_drops[current_stage].setdefault(item, 0) + all_stage_drops[current_stage][item] += count # 将累加后的掉落数据保存到结果中 data["drop_statistics"] = all_stage_drops @@ -944,3 +940,5 @@ class MaaConfig(QConfig): Config = AppConfig() + +