Skip to content

Commit 24991f0

Browse files
DrSmoothlCopilot
andcommitted
v7
Co-authored-by: Copilot <copilot@github.com>
1 parent c3a7e6d commit 24991f0

63 files changed

Lines changed: 8104 additions & 2450 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

![[点我启动!!!.bat

Lines changed: 0 additions & 67 deletions
This file was deleted.

![如果一键包无限更新的话点我!!.bat

Lines changed: 0 additions & 34 deletions
This file was deleted.

![更新一键包仓库.bat

Lines changed: 0 additions & 19 deletions
This file was deleted.

![更新所有模块.bat

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- master
9+
- desktop
10+
11+
jobs:
12+
electron-build:
13+
name: Typecheck and build (${{ matrix.os }})
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os:
19+
- ubuntu-latest
20+
- macos-latest
21+
- windows-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Bun
28+
uses: oven-sh/setup-bun@v2
29+
30+
- name: Install dependencies
31+
run: bun install --frozen-lockfile
32+
33+
- name: Typecheck
34+
run: bun run typecheck
35+
36+
- name: Build Electron app
37+
run: bun run build
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Windows Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
payload_url:
7+
description: Zip URL containing runtime/ and modules/.
8+
required: false
9+
type: string
10+
payload_sha256:
11+
description: Optional SHA-256 for the payload zip.
12+
required: false
13+
type: string
14+
tag_name:
15+
description: Optional tag to publish as a draft GitHub release, for example v0.1.0.
16+
required: false
17+
type: string
18+
create_github_release:
19+
description: Create a draft GitHub release from the generated installer.
20+
required: true
21+
default: false
22+
type: boolean
23+
prerelease:
24+
description: Mark the GitHub release as prerelease.
25+
required: true
26+
default: false
27+
type: boolean
28+
29+
permissions:
30+
contents: write
31+
32+
jobs:
33+
windows-installer:
34+
name: Build Windows x64 installer
35+
runs-on: windows-latest
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Setup Bun
42+
uses: oven-sh/setup-bun@v2
43+
44+
- name: Install dependencies
45+
run: bun install --frozen-lockfile
46+
47+
- name: Validate GitHub release input
48+
if: ${{ inputs.create_github_release && inputs.tag_name == '' }}
49+
shell: pwsh
50+
run: throw "tag_name is required when create_github_release is true."
51+
52+
- name: Download release payload
53+
if: ${{ inputs.payload_url != '' }}
54+
shell: pwsh
55+
run: |
56+
Invoke-WebRequest -Uri "${{ inputs.payload_url }}" -OutFile payload.zip
57+
58+
if ("${{ inputs.payload_sha256 }}" -ne "") {
59+
$actual = (Get-FileHash payload.zip -Algorithm SHA256).Hash.ToLowerInvariant()
60+
$expected = "${{ inputs.payload_sha256 }}".ToLowerInvariant()
61+
if ($actual -ne $expected) {
62+
throw "Payload SHA-256 mismatch. Expected $expected, got $actual."
63+
}
64+
}
65+
66+
New-Item -ItemType Directory -Force -Path .payload | Out-Null
67+
Expand-Archive payload.zip -DestinationPath .payload -Force
68+
69+
$payloadRoot = Resolve-Path .payload
70+
if (!(Test-Path (Join-Path $payloadRoot "runtime")) -or !(Test-Path (Join-Path $payloadRoot "modules"))) {
71+
$candidate = Get-ChildItem .payload -Directory | Where-Object {
72+
(Test-Path (Join-Path $_.FullName "runtime")) -and (Test-Path (Join-Path $_.FullName "modules"))
73+
} | Select-Object -First 1
74+
75+
if ($null -eq $candidate) {
76+
throw "Payload zip must contain runtime/ and modules/ at its root or one directory below the root."
77+
}
78+
79+
$payloadRoot = $candidate.FullName
80+
}
81+
82+
if (Test-Path runtime) {
83+
Remove-Item runtime -Recurse -Force
84+
}
85+
if (Test-Path modules) {
86+
Remove-Item modules -Recurse -Force
87+
}
88+
89+
Move-Item (Join-Path $payloadRoot "runtime") runtime
90+
Move-Item (Join-Path $payloadRoot "modules") modules
91+
92+
- name: Check release payload
93+
run: bun run release:check
94+
95+
- name: Build installer
96+
run: bun run release:win
97+
98+
- name: Upload installer artifact
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: maibot-onekey-windows-x64
102+
path: |
103+
release/*.exe
104+
release/*.blockmap
105+
release/*.yml
106+
if-no-files-found: error
107+
108+
- name: Create draft GitHub release
109+
if: ${{ inputs.create_github_release && inputs.tag_name != '' }}
110+
env:
111+
GH_TOKEN: ${{ github.token }}
112+
TAG_NAME: ${{ inputs.tag_name }}
113+
shell: pwsh
114+
run: |
115+
$assets = Get-ChildItem release -File | Where-Object {
116+
$_.Name -match '\.(exe|blockmap|yml)$'
117+
} | Select-Object -ExpandProperty FullName
118+
119+
if ($assets.Count -eq 0) {
120+
throw "No release assets found."
121+
}
122+
123+
$args = @("release", "create", $env:TAG_NAME)
124+
$args += $assets
125+
$args += @("--title", $env:TAG_NAME, "--generate-notes", "--draft")
126+
127+
if ("${{ inputs.prerelease }}" -eq "true") {
128+
$args += "--prerelease"
129+
}
130+
131+
gh @args

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ __pycache__/
66
# C extensions
77
*.so
88

9-
9+
/node_modules/
10+
/out/
11+
/release/
12+
/.payload/
13+
/payload.zip
14+
/release-payload*.zip
1015

1116
MaiBot/
1217
modules/
@@ -20,7 +25,6 @@ dist/
2025
downloads/
2126
eggs/
2227
.eggs/
23-
lib/
2428
lib64/
2529
parts/
2630
sdist/
@@ -197,4 +201,4 @@ cython_debug/
197201
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
198202
# refer to https://docs.cursor.com/context/ignore-files
199203
.cursorignore
200-
.cursorindexingignore
204+
.cursorindexingignore

0 commit comments

Comments
 (0)