跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

windows-build.yml

235 行 · 9.5 KB历史下载
1name: Reusable Windows build and installer
2on:
3 workflow_call:
4 inputs:
5 ref:
6 description: Exact 40-character commit SHA to build
7 required: true
8 type: string
9 release:
10 description: Require trusted signing and reviewed corresponding sources
11 type: boolean
12 default: false
13 artifact_name:
14 description: Release artifact name, or development artifact prefix
15 required: true
16 type: string
17permissions:
18 contents: read
19jobs:
20 development:
21 if: ${{ !inputs.release }}
22 strategy:
23 fail-fast: false
24 matrix:
25 os: [windows-2022, windows-2025]
26 runs-on: ${{ matrix.os }}
27 timeout-minutes: 60
28 defaults:
29 run:
30 shell: pwsh
31 steps:
32 - uses: actions/checkout@v4
33 with:
34 ref: ${{ inputs.ref }}
35 persist-credentials: false
36 - uses: actions/setup-go@v5
37 with:
38 go-version-file: go.mod
39 - uses: actions/setup-node@v4
40 with:
41 node-version: 24
42 cache: npm
43 cache-dependency-path: ui/package-lock.json
44 - uses: actions/setup-dotnet@v4
45 with:
46 dotnet-version: 10.0.403
47 - uses: astral-sh/[email protected]
48 - uses: msys2/setup-msys2@v2
49 id: msys2
50 with:
51 msystem: UCRT64
52 update: true
53 install: >-
54 make patch diffutils git findutils curl
55 mingw-w64-ucrt-x86_64-gcc
56 mingw-w64-ucrt-x86_64-glib2
57 mingw-w64-ucrt-x86_64-pixman
58 mingw-w64-ucrt-x86_64-libslirp
59 mingw-w64-ucrt-x86_64-dtc
60 mingw-w64-ucrt-x86_64-ninja
61 mingw-w64-ucrt-x86_64-python
62 mingw-w64-ucrt-x86_64-pkgconf
63 - uses: actions/cache/restore@v4
64 id: qemu_cache
65 with:
66 path: _output/windows-deps
67 key: cage-windows-deps-${{ hashFiles('packaging/windows/dependencies.json', 'patches/qemu/**', 'scripts/build-qemu-windows.*') }}
68 restore-keys: cage-windows-deps-
69 - name: Build and verify QEMU runtime before application acceptance
70 env:
71 CAGE_MSYS2_ROOT: ${{ steps.msys2.outputs.msys2-location }}
72 run: ./scripts/build-qemu-windows.ps1
73 - name: Preserve only the completed verified runtime cache
74 if: steps.qemu_cache.outputs.cache-hit != 'true'
75 uses: actions/cache/save@v4
76 with:
77 path: _output/windows-deps
78 key: cage-windows-deps-${{ hashFiles('packaging/windows/dependencies.json', 'patches/qemu/**', 'scripts/build-qemu-windows.*') }}
79 - name: Build, test and install the unsigned development package
80 env:
81 CAGE_BUILD_REF: ${{ inputs.ref }}
82 CAGE_MSYS2_ROOT: ${{ steps.msys2.outputs.msys2-location }}
83 run: ./scripts/ci-windows-build.ps1
84 - uses: actions/upload-artifact@v4
85 with:
86 name: ${{ inputs.artifact_name }}-${{ matrix.os }}
87 path: _output/releases/*/windows/*
88 if-no-files-found: error
89 overwrite: true
90 retention-days: 14
91 - name: Preserve failed unsigned candidates for installation debugging
92 if: ${{ always() && job.status != 'success' }}
93 uses: actions/upload-artifact@v4
94 with:
95 name: ${{ inputs.artifact_name }}-${{ matrix.os }}-failed-candidate
96 path: |
97 _output/windows-amd64/app/**
98 _output/releases/*/windows/Cage-*-windows-amd64-setup-unsigned.exe
99 _output/releases/*/windows/SHA256SUMS
100 if-no-files-found: ignore
101 compression-level: 0
102 overwrite: true
103 retention-days: 14
104 - name: Preserve public test reports
105 if: always()
106 uses: actions/upload-artifact@v4
107 with:
108 name: ${{ inputs.artifact_name }}-${{ matrix.os }}-reports
109 path: |
110 ${{ runner.temp }}/cage-smoke-*.json
111 ${{ runner.temp }}/cage-build-ui-*/smoke.json
112 ${{ runner.temp }}/cage-build-ui-*/*.png
113 if-no-files-found: ignore
114 overwrite: true
115 retention-days: 14
116 release:
117 if: ${{ inputs.release }}
118 runs-on: windows-2025
119 environment: cage-release
120 timeout-minutes: 60
121 defaults:
122 run:
123 shell: pwsh
124 steps:
125 - uses: actions/checkout@v4
126 with:
127 ref: ${{ inputs.ref }}
128 persist-credentials: false
129 - uses: actions/setup-go@v5
130 with:
131 go-version-file: go.mod
132 - uses: actions/setup-node@v4
133 with:
134 node-version: 24
135 cache: npm
136 cache-dependency-path: ui/package-lock.json
137 - uses: actions/setup-dotnet@v4
138 with:
139 dotnet-version: 10.0.403
140 - uses: astral-sh/[email protected]
141 - uses: msys2/setup-msys2@v2
142 id: msys2
143 with:
144 msystem: UCRT64
145 update: true
146 install: >-
147 make patch diffutils git findutils curl
148 mingw-w64-ucrt-x86_64-gcc
149 mingw-w64-ucrt-x86_64-glib2
150 mingw-w64-ucrt-x86_64-pixman
151 mingw-w64-ucrt-x86_64-libslirp
152 mingw-w64-ucrt-x86_64-dtc
153 mingw-w64-ucrt-x86_64-ninja
154 mingw-w64-ucrt-x86_64-python
155 mingw-w64-ucrt-x86_64-pkgconf
156 - uses: actions/cache/restore@v4
157 id: qemu_cache
158 with:
159 path: _output/windows-deps
160 restore-keys: cage-windows-deps-
161 key: cage-windows-deps-${{ hashFiles('packaging/windows/dependencies.json', 'patches/qemu/**', 'scripts/build-qemu-windows.*') }}
162 - name: Build and verify QEMU runtime and package identity
163 id: qemu_build
164 env:
165 CAGE_MSYS2_ROOT: ${{ steps.msys2.outputs.msys2-location }}
166 run: |
167 ./scripts/build-qemu-windows.ps1
168 $identity = Get-Content '_output/windows-deps/qemu-cage/cage-build.json' -Raw | ConvertFrom-Json
169 "fingerprint=$($identity.fingerprint)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
170 "manifest=$((Get-FileHash '_output/windows-deps/qemu-cage/cage-build.json' -Algorithm SHA256).Hash)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
171 $collectorHash = (Get-FileHash 'scripts/bundle-qemu-sources.sh' -Algorithm SHA256).Hash + (Get-FileHash 'scripts/prepare-qemu-release.ps1' -Algorithm SHA256).Hash
172 "collector=$collectorHash" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
173 - name: Preserve only the completed verified runtime cache
174 if: steps.qemu_cache.outputs.cache-hit != 'true'
175 uses: actions/cache/save@v4
176 with:
177 path: _output/windows-deps
178 key: cage-windows-deps-${{ hashFiles('packaging/windows/dependencies.json', 'patches/qemu/**', 'scripts/build-qemu-windows.*') }}
179 - uses: actions/cache/restore@v4
180 id: qemu_sources
181 with:
182 path: _output/windows-qemu-sources
183 key: cage-qemu-sources-${{ steps.qemu_build.outputs.fingerprint }}-${{ steps.qemu_build.outputs.manifest }}-${{ steps.qemu_build.outputs.collector }}
184 - name: Collect and verify corresponding sources before signing
185 env:
186 CAGE_MSYS2_ROOT: ${{ steps.msys2.outputs.msys2-location }}
187 run: ./scripts/prepare-qemu-release.ps1
188 - name: Preserve only the completed verified source cache
189 if: steps.qemu_sources.outputs.cache-hit != 'true'
190 uses: actions/cache/save@v4
191 with:
192 path: _output/windows-qemu-sources
193 key: cage-qemu-sources-${{ steps.qemu_build.outputs.fingerprint }}-${{ steps.qemu_build.outputs.manifest }}-${{ steps.qemu_build.outputs.collector }}
194 - uses: actions/setup-java@v4
195 with:
196 distribution: temurin
197 java-version: '21'
198 - name: Build, sign, test and install the release candidate
199 env:
200 CAGE_BUILD_REF: ${{ inputs.ref }}
201 CAGE_MSYS2_ROOT: ${{ steps.msys2.outputs.msys2-location }}
202 CAGE_WINDOWS_SIGNING_PROVIDER: ${{ vars.CAGE_WINDOWS_SIGNING_PROVIDER }}
203 CAGE_ESIGNER_USERNAME: ${{ secrets.CAGE_ESIGNER_USERNAME }}
204 CAGE_ESIGNER_PASSWORD: ${{ secrets.CAGE_ESIGNER_PASSWORD }}
205 CAGE_ESIGNER_CREDENTIAL_ID: ${{ secrets.CAGE_ESIGNER_CREDENTIAL_ID }}
206 CAGE_ESIGNER_CERTIFICATE_SERIAL: ${{ vars.CAGE_ESIGNER_CERTIFICATE_SERIAL }}
207 CAGE_ESIGNER_TOTP_SECRET: ${{ secrets.CAGE_ESIGNER_TOTP_SECRET }}
208 CAGE_WINDOWS_PFX_BASE64: ${{ secrets.CAGE_WINDOWS_PFX_BASE64 }}
209 CAGE_WINDOWS_PFX_PASSWORD: ${{ secrets.CAGE_WINDOWS_PFX_PASSWORD }}
210 run: ./scripts/ci-windows-build.ps1 -Release
211 - uses: actions/upload-artifact@v4
212 with:
213 name: ${{ inputs.artifact_name }}
214 path: |
215 _output/releases/*/windows/Cage-*-windows-amd64-setup.exe
216 _output/releases/*/windows/SHA256SUMS
217 _output/releases/*/windows/mihomo-*-source.tar.gz
218 _output/releases/*/windows/qemu-*-source.tar.gz
219 _output/releases/*/windows/qemu-*-windows-full-source.*
220 _output/releases/*/windows/build-metadata.json
221 if-no-files-found: error
222 overwrite: true
223 retention-days: 14
224 - name: Preserve public release acceptance reports
225 if: always()
226 uses: actions/upload-artifact@v4
227 with:
228 name: ${{ inputs.artifact_name }}-reports
229 path: |
230 ${{ runner.temp }}/cage-smoke-*.json
231 ${{ runner.temp }}/cage-build-ui-*/smoke.json
232 ${{ runner.temp }}/cage-build-ui-*/*.png
233 if-no-files-found: ignore
234 retention-days: 14
235 # The caller owns publication. This workflow has no repository write access.