Skip to content

Commit 3074911

Browse files
committed
v1.0.1 (#7)
* 修复导出Markdown * 修复导出Markdown+删除确认弹窗 * 添加自动更新功能 * 更新版本号 修复导出markdown 修复workflow 修复workflow 优化发布 修复发布
1 parent 7da0956 commit 3074911

File tree

22 files changed

+792
-39
lines changed

22 files changed

+792
-39
lines changed

.github/workflows/tauri-release.yml

Lines changed: 104 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tauri Draft Release
1+
name: Tauri Release
22

33
on:
44
push:
@@ -10,19 +10,23 @@ permissions:
1010
contents: write
1111

1212
jobs:
13-
publish-tauri:
13+
build-tauri:
1414
strategy:
1515
fail-fast: false
1616
matrix:
1717
include:
1818
- platform: "ubuntu-latest"
1919
args: ""
20+
artifact_name: "updater-json-linux"
2021
- platform: "windows-latest"
2122
args: "--target x86_64-pc-windows-msvc --no-sign"
23+
artifact_name: "updater-json-windows"
2224
- platform: "macos-latest"
2325
args: "--target aarch64-apple-darwin --no-sign"
26+
artifact_name: "updater-json-macos-aarch64"
2427
- platform: "macos-latest"
2528
args: "--target x86_64-apple-darwin --no-sign"
29+
artifact_name: "updater-json-macos-x64"
2630

2731
runs-on: ${{ matrix.platform }}
2832

@@ -63,13 +67,109 @@ jobs:
6367
run: pnpm install --frozen-lockfile
6468

6569
- name: Build and publish Tauri app
70+
id: tauri_build
6671
uses: tauri-apps/tauri-action@v0
6772
env:
6873
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
75+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
6976
with:
7077
tagName: v__VERSION__
7178
releaseName: "DeepLab v__VERSION__"
72-
releaseBody: "Draft release build for DeepLab v__VERSION__."
73-
releaseDraft: true
79+
releaseBody: "Automated release build for DeepLab v__VERSION__."
80+
releaseDraft: false
7481
prerelease: false
82+
uploadUpdaterJson: false
7583
args: ${{ matrix.args }}
84+
85+
- name: Collect updater json fragments
86+
shell: bash
87+
run: |
88+
mkdir -p updater-json
89+
node <<'NODE'
90+
const fs = require("fs");
91+
const paths = JSON.parse(process.env.TAURI_ARTIFACT_PATHS || "[]");
92+
if (!Array.isArray(paths) || paths.length === 0) {
93+
throw new Error("tauri-action output artifactPaths is empty");
94+
}
95+
const latest = paths.find((p) => typeof p === "string" && p.endsWith("/latest.json"));
96+
if (!latest) {
97+
console.error("artifactPaths:");
98+
for (const p of paths) console.error(`- ${p}`);
99+
throw new Error("latest.json not found in tauri-action artifactPaths");
100+
}
101+
const outPath = `updater-json/${process.env.ARTIFACT_NAME}.json`;
102+
fs.copyFileSync(latest, outPath);
103+
console.log(`copied ${latest} -> ${outPath}`);
104+
NODE
105+
ls -la updater-json
106+
env:
107+
TAURI_ARTIFACT_PATHS: ${{ steps.tauri_build.outputs.artifactPaths }}
108+
ARTIFACT_NAME: ${{ matrix.artifact_name }}
109+
110+
- name: Upload updater json fragments
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: ${{ matrix.artifact_name }}
114+
path: updater-json/${{ matrix.artifact_name }}.json
115+
if-no-files-found: error
116+
117+
merge-updater-json:
118+
needs: build-tauri
119+
runs-on: ubuntu-latest
120+
steps:
121+
- name: Download updater json fragments
122+
uses: actions/download-artifact@v4
123+
with:
124+
path: updater-json-fragments
125+
pattern: updater-json-*
126+
merge-multiple: true
127+
128+
- name: Merge latest.json from all platforms
129+
shell: bash
130+
run: |
131+
node <<'NODE'
132+
const fs = require("fs");
133+
const path = require("path");
134+
const dir = "updater-json-fragments";
135+
const files = fs.readdirSync(dir).filter((f) => f.endsWith(".json"));
136+
if (files.length === 0) {
137+
throw new Error("No updater latest.json fragments found");
138+
}
139+
let base = null;
140+
const mergedPlatforms = {};
141+
for (const file of files) {
142+
const fullPath = path.join(dir, file);
143+
const json = JSON.parse(fs.readFileSync(fullPath, "utf8"));
144+
if (!base) {
145+
base = {
146+
version: json.version,
147+
notes: json.notes ?? "",
148+
pub_date: json.pub_date,
149+
platforms: {},
150+
};
151+
}
152+
if (json.platforms && typeof json.platforms === "object") {
153+
Object.assign(mergedPlatforms, json.platforms);
154+
}
155+
}
156+
base.platforms = mergedPlatforms;
157+
if (Object.keys(base.platforms).length === 0) {
158+
throw new Error("Merged latest.json has no platforms");
159+
}
160+
fs.writeFileSync("latest.json", JSON.stringify(base, null, 2));
161+
console.log(`Merged platforms: ${Object.keys(base.platforms).join(", ")}`);
162+
NODE
163+
cat latest.json
164+
165+
- name: Upload merged latest.json to release
166+
uses: softprops/action-gh-release@v2
167+
env:
168+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
169+
with:
170+
tag_name: ${{ github.ref_name }}
171+
files: latest.json
172+
overwrite_files: true
173+
make_latest: true
174+
draft: false
175+
prerelease: false

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./.next/types/routes.d.ts";
3+
import "./dist/dev/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "DeepLab",
33
"private": true,
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"type": "module",
66
"packageManager": "pnpm@10.30.1",
77
"scripts": {
@@ -25,6 +25,7 @@
2525
"@tauri-apps/plugin-fs": "^2.4.5",
2626
"@tauri-apps/plugin-opener": "^2.5.3",
2727
"@tauri-apps/plugin-sql": "^2.3.2",
28+
"@tauri-apps/plugin-updater": "^2.9.0",
2829
"@tiptap/core": "^3.20.1",
2930
"@tiptap/extension-code-block": "^3.20.1",
3031
"@tiptap/extension-link": "^3.20.1",

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/.gitignore

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Generated by Cargo
22
# will have compiled files and executables
3-
/target/
4-
5-
# Generated by Tauri
6-
# will have schema files for capabilities auto-completion
7-
/gen/schemas
3+
/target/
4+
5+
# Generated by Tauri
6+
# will have schema files for capabilities auto-completion
7+
/gen/schemas
8+
9+
# local updater signing keys
10+
/.keys

0 commit comments

Comments
 (0)