Skip to content

Commit c9dfb3b

Browse files
Yvictorec666
authored andcommitted
ci: tauri auto update
1 parent 1be8b8f commit c9dfb3b

File tree

3 files changed

+51
-3
lines changed

3 files changed

+51
-3
lines changed

.github/workflows/desktop.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ jobs:
161161
APPLE_ID: ${{ env.APPLE_ID_SECRET }}
162162
APPLE_PASSWORD: ${{ env.APPLE_PASSWORD_SECRET }}
163163
APPLE_TEAM_ID: ${{ env.APPLE_TEAM_ID_SECRET }}
164+
# 新增:Tauri 更新簽名
165+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
164166

165167
- name: Package macOS Artifacts
166168
id: package_macos # MODIFIED: Added id for output referencing
@@ -213,6 +215,7 @@ jobs:
213215
name: macos-build
214216
path: |
215217
${{ steps.package_macos.outputs.dmg_name_output }}
218+
${{ steps.package_macos.outputs.dmg_name_output }}.sig
216219
217220
Build-windows:
218221
name: Build Windows App (x64)
@@ -311,6 +314,8 @@ jobs:
311314
run: pnpm build:windows
312315
env:
313316
VITE_ENV: ${{ env.D_IS_STAGING_BUILD_ENV == 'True' && 'staging' || 'production' }}
317+
# 新增:Tauri 更新簽名
318+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
314319

315320
- name: Locate Windows Artifact
316321
id: locate_msi
@@ -350,7 +355,9 @@ jobs:
350355
uses: actions/upload-artifact@v4
351356
with:
352357
name: windows-build
353-
path: ${{ steps.locate_msi.outputs.msi_name }}
358+
path: |
359+
${{ steps.locate_msi.outputs.msi_name }}
360+
${{ steps.locate_msi.outputs.msi_name }}.sig
354361
355362
create-release:
356363
name: Create GitHub Release
@@ -483,6 +490,46 @@ jobs:
483490
echo "--- Release Notes file in workspace root: ---"
484491
ls -l ${{ github.workspace }}/RELEASE_NOTES_DESKTOP.md
485492
493+
- name: Generate Update Manifest
494+
run: |
495+
# Get artifact file names
496+
MACOS_DMG=$(ls artifacts/macos-build/*.dmg | head -n 1)
497+
MACOS_SIG=$(ls artifacts/macos-build/*.dmg.sig | head -n 1)
498+
WINDOWS_MSI=$(ls artifacts/windows-build/*.msi | head -n 1)
499+
WINDOWS_SIG=$(ls artifacts/windows-build/*.msi.sig | head -n 1)
500+
501+
# Read signature contents
502+
MACOS_SIGNATURE=$(cat "$MACOS_SIG" | tr -d '\n\r')
503+
WINDOWS_SIGNATURE=$(cat "$WINDOWS_SIG" | tr -d '\n\r')
504+
505+
# Create update manifest
506+
cat > update-manifest.json << EOF
507+
{
508+
"version": "${{ env.CR_DISPLAY_VERSION }}",
509+
"notes": "檢查 Release Notes 了解詳細更新內容",
510+
"pub_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
511+
"platforms": {
512+
"darwin-universal": {
513+
"signature": "$MACOS_SIGNATURE",
514+
"url": "https://github.com/Sinotrade/scone/releases/download/${{ steps.release_info.outputs.canonical_tag_output }}/$(basename "$MACOS_DMG")"
515+
},
516+
"windows-x86_64": {
517+
"signature": "$WINDOWS_SIGNATURE",
518+
"url": "https://github.com/Sinotrade/scone/releases/download/${{ steps.release_info.outputs.canonical_tag_output }}/$(basename "$WINDOWS_MSI")"
519+
}
520+
}
521+
}
522+
EOF
523+
524+
echo "Generated update manifest:"
525+
cat update-manifest.json
526+
527+
- name: Upload Update Manifest
528+
uses: actions/upload-artifact@v4
529+
with:
530+
name: update-manifest
531+
path: update-manifest.json
532+
486533
- name: Clean up old DMG/MSI assets from Staging Release
487534
if: steps.release_info.outputs.prerelease_output == 'true' # Only run for staging/prerelease
488535
env:
@@ -533,3 +580,4 @@ jobs:
533580
files: |
534581
artifacts/macos-build/*
535582
artifacts/windows-build/*
583+
update-manifest.json

.github/workflows/mobile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,4 @@ jobs:
209209
files: |
210210
mobile-release-assets/*.zip
211211
mobile-release-assets/*.checksum
212-
mobile-release-assets/key
212+
mobile-release-assets/key

.github/workflows/web.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ jobs:
6060
id: deployment
6161
uses: actions/deploy-pages@v4
6262
with:
63-
artifact_name: github-pages
63+
artifact_name: github-pages

0 commit comments

Comments
 (0)