Skip to content

Commit 53ce05f

Browse files
committed
chore: merge origin/main into feture/log-0729
Resolve add/add conflicts: keep the branch website (main's site plus the Obsidian section), take main's 1.0.2 DMG design QA notes and assets, and combine both .gitignore additions.
2 parents c27f83b + abc2bf6 commit 53ce05f

28 files changed

Lines changed: 1433 additions & 343 deletions

.github/labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
- "tailwind.config.js"
3232
- "postcss.config.js"
3333

34+
"area: website":
35+
- changed-files:
36+
- any-glob-to-any-file:
37+
- "website/**"
38+
3439
"area: main":
3540
- changed-files:
3641
- any-glob-to-any-file:

.github/workflows/build-platforms.yml

Lines changed: 147 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
tags:
77
- 'v*'
88

9+
concurrency:
10+
group: build-platforms-${{ github.ref }}
11+
cancel-in-progress: false
12+
913
env:
1014
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1115
NODE_OPTIONS: --max-old-space-size=6144
@@ -14,120 +18,209 @@ permissions:
1418
contents: write
1519

1620
jobs:
17-
# ========== macOS Apple Silicon 构建 ==========
18-
build-macos-arm64:
19-
runs-on: macos-latest
21+
prepare:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
prerelease: ${{ steps.metadata.outputs.prerelease }}
25+
tag: ${{ steps.metadata.outputs.tag }}
26+
version: ${{ steps.metadata.outputs.version }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Resolve release version
31+
id: metadata
32+
shell: bash
33+
run: |
34+
set -euo pipefail
35+
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
36+
node scripts/release-metadata.cjs --tag "$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
37+
else
38+
node scripts/release-metadata.cjs >> "$GITHUB_OUTPUT"
39+
fi
40+
41+
- name: Show build metadata
42+
env:
43+
RELEASE_TAG: ${{ steps.metadata.outputs.tag }}
44+
RELEASE_VERSION: ${{ steps.metadata.outputs.version }}
45+
run: |
46+
echo "Release version: $RELEASE_VERSION"
47+
echo "Release tag: $RELEASE_TAG"
48+
49+
build-macos:
50+
needs: prepare
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
include:
55+
- arch: arm64
56+
artifact: macos-arm64-build
57+
runner: macos-latest
58+
runner_arch: arm64
59+
- arch: x64
60+
artifact: macos-x64-build
61+
runner: macos-15-intel
62+
runner_arch: x86_64
63+
runs-on: ${{ matrix.runner }}
2064
env:
2165
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_PWD }}
2266
APPLE_ID: ${{ secrets.APPLE_ID }}
2367
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
2468
CSC_IDENTITY_AUTO_DISCOVERY: true
2569
CSC_KEY_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
2670
CSC_LINK: ${{ secrets.MACOS_CERTIFICATE }}
71+
WESIGHT_RELEASE_VERSION: ${{ needs.prepare.outputs.version }}
2772
WESIGHT_REQUIRE_APPLE_NOTARIZATION: true
2873
steps:
2974
- uses: actions/checkout@v4
75+
3076
- uses: actions/setup-node@v4
3177
with:
3278
node-version: '24.x'
79+
3380
- uses: actions/cache@v4
3481
with:
3582
path: ~/.npm
36-
key: npm-${{ runner.os }}-${{ hashFiles('package.json') }}
37-
restore-keys: npm-${{ runner.os }}-
83+
key: npm-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('package.json') }}
84+
restore-keys: npm-${{ runner.os }}-${{ matrix.arch }}-
3885

39-
- run: npm install
86+
- name: Install dependencies
87+
run: npm install
4088

41-
- name: Verify Apple Silicon runner
89+
- name: Verify runner architecture
90+
env:
91+
EXPECTED_NODE_ARCH: ${{ matrix.arch }}
92+
EXPECTED_RUNNER_ARCH: ${{ matrix.runner_arch }}
4293
run: |
43-
test "$(uname -m)" = "arm64"
44-
node -e "if (process.arch !== 'arm64') process.exit(1)"
94+
test "$(uname -m)" = "$EXPECTED_RUNNER_ARCH"
95+
node -e "if (process.arch !== process.env.EXPECTED_NODE_ARCH) process.exit(1)"
4596
46-
- name: Build macOS arm64
47-
run: npm run dist:mac:arm64 -- --publish never -c.forceCodeSigning=true
97+
- name: Build macOS ${{ matrix.arch }}
98+
run: npm run dist:mac:${{ matrix.arch }} -- --publish never -c.forceCodeSigning=true
4899

49-
- name: Verify macOS arm64 artifact
50-
run: npm run verify:mac:arm64-artifact
100+
- name: Verify macOS ${{ matrix.arch }} artifact
101+
run: npm run verify:mac:${{ matrix.arch }}-artifact
51102

52103
- uses: actions/upload-artifact@v4
53104
with:
54-
name: macos-arm64-build
55-
path: release/*.dmg
105+
name: ${{ matrix.artifact }}
106+
path: release/WeSight.${{ needs.prepare.outputs.version }}.mac.${{ matrix.arch }}.dmg
107+
if-no-files-found: error
56108
retention-days: 7
57109

58-
# ========== macOS Intel 构建 ==========
59-
build-macos-x64:
60-
runs-on: macos-15-intel
110+
build-windows:
111+
needs: prepare
112+
runs-on: windows-latest
61113
env:
62-
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_PWD }}
63-
APPLE_ID: ${{ secrets.APPLE_ID }}
64-
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
65-
CSC_IDENTITY_AUTO_DISCOVERY: true
66-
CSC_KEY_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
67-
CSC_LINK: ${{ secrets.MACOS_CERTIFICATE }}
68-
WESIGHT_REQUIRE_APPLE_NOTARIZATION: true
114+
CSC_IDENTITY_AUTO_DISCOVERY: false
115+
WESIGHT_RELEASE_VERSION: ${{ needs.prepare.outputs.version }}
69116
steps:
70117
- uses: actions/checkout@v4
118+
71119
- uses: actions/setup-node@v4
72120
with:
73121
node-version: '24.x'
122+
74123
- uses: actions/cache@v4
75124
with:
76125
path: ~/.npm
77126
key: npm-${{ runner.os }}-x64-${{ hashFiles('package.json') }}
78127
restore-keys: npm-${{ runner.os }}-x64-
79128

80-
- run: npm install
129+
- name: Install dependencies
130+
run: npm install
81131

82-
- name: Verify Intel runner
83-
run: |
84-
test "$(uname -m)" = "x86_64"
85-
node -e "if (process.arch !== 'x64') process.exit(1)"
86-
87-
- name: Build macOS x64
88-
run: npm run dist:mac:x64 -- --publish never -c.forceCodeSigning=true
132+
- name: Build Windows x64 installer
133+
run: npm run dist:win -- --publish never
89134

90-
- name: Verify macOS x64 artifact
91-
run: npm run verify:mac:x64-artifact
135+
- name: Verify Windows x64 artifact
136+
run: npm run verify:win:x64-artifact
92137

93138
- uses: actions/upload-artifact@v4
94139
with:
95-
name: macos-x64-build
96-
path: release/*.dmg
140+
name: windows-x64-build
141+
path: |
142+
release/WeSight.Setup.${{ needs.prepare.outputs.version }}.exe
143+
release/WeSight.Setup.${{ needs.prepare.outputs.version }}.exe.blockmap
144+
release/latest.yml
145+
if-no-files-found: error
97146
retention-days: 7
98147

99-
# ========== 创建 Release ==========
100148
create-release:
101-
needs: [build-macos-arm64, build-macos-x64]
102-
runs-on: ubuntu-latest
149+
needs:
150+
- prepare
151+
- build-macos
152+
- build-windows
103153
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
154+
runs-on: ubuntu-latest
104155
steps:
105156
- uses: actions/checkout@v4
106157

107-
- name: Download All Artifacts
108-
uses: actions/download-artifact@v4
158+
- uses: actions/download-artifact@v4
109159
with:
110160
path: artifacts
111161

112-
- name: Create Draft Release
162+
- name: Collect release assets and checksums
163+
shell: bash
164+
run: |
165+
set -euo pipefail
166+
mkdir -p release-assets
167+
cp artifacts/macos-arm64-build/*.dmg release-assets/
168+
cp artifacts/macos-x64-build/*.dmg release-assets/
169+
cp artifacts/windows-x64-build/*.exe release-assets/
170+
cp artifacts/windows-x64-build/*.blockmap release-assets/
171+
cp artifacts/windows-x64-build/latest.yml release-assets/
172+
173+
(
174+
cd release-assets
175+
find . -maxdepth 1 -type f -print0 \
176+
| sort -z \
177+
| xargs -0 sha256sum \
178+
| sed 's# \\./# #' > ../SHASUMS256.txt
179+
mv ../SHASUMS256.txt SHASUMS256.txt
180+
)
181+
182+
- name: Publish GitHub Release
113183
env:
114184
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115-
TAG_NAME: ${{ github.ref_name }}
185+
IS_PRERELEASE: ${{ needs.prepare.outputs.prerelease }}
186+
TAG_NAME: ${{ needs.prepare.outputs.tag }}
187+
shell: bash
116188
run: |
117189
set -euo pipefail
118190
119-
args=(
120-
"$TAG_NAME"
121-
artifacts/macos-arm64-build/*.dmg
122-
artifacts/macos-x64-build/*.dmg
123-
--draft
124-
--generate-notes
125-
--title "$TAG_NAME"
191+
node scripts/render-release-notes.cjs "$TAG_NAME" release-notes.md
192+
193+
release_args=(
126194
--repo "$GITHUB_REPOSITORY"
195+
--title "$TAG_NAME"
196+
--verify-tag
127197
)
128198
129-
if [[ "$TAG_NAME" == *"-alpha"* || "$TAG_NAME" == *"-beta"* || "$TAG_NAME" == *"-rc"* ]]; then
130-
args+=(--prerelease)
199+
if [[ "$IS_PRERELEASE" == "true" ]]; then
200+
release_args+=(--prerelease)
201+
else
202+
release_args+=(--latest)
131203
fi
132204
133-
gh release create "${args[@]}"
205+
if gh release view "$TAG_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
206+
gh release upload \
207+
"$TAG_NAME" \
208+
release-assets/* \
209+
--clobber \
210+
--repo "$GITHUB_REPOSITORY"
211+
gh release edit \
212+
"$TAG_NAME" \
213+
"${release_args[@]}" \
214+
--draft=false \
215+
--prerelease="$IS_PRERELEASE" \
216+
--notes-file release-notes.md
217+
else
218+
if [[ "$IS_PRERELEASE" == "true" ]]; then
219+
release_args+=(--latest=false)
220+
fi
221+
gh release create \
222+
"$TAG_NAME" \
223+
release-assets/* \
224+
"${release_args[@]}" \
225+
--notes-file release-notes.md
226+
fi

.github/workflows/build-windows-release.yml

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

0 commit comments

Comments
 (0)