File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Test Build
2+
3+ on :
4+ push :
5+ branches : [main-go]
6+ workflow_dispatch :
7+
8+ jobs :
9+ # ── Build Docker images (tagged with commit SHA) ──
10+ docker :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : read
14+ packages : write
15+ strategy :
16+ matrix :
17+ target : [prod, dev]
18+ steps :
19+ - uses : actions/checkout@v4
20+
21+ - name : Log in to GHCR
22+ uses : docker/login-action@v3
23+ with :
24+ registry : ghcr.io
25+ username : ${{ github.actor }}
26+ password : ${{ secrets.GITHUB_TOKEN }}
27+
28+ - name : Build & push
29+ uses : docker/build-push-action@v6
30+ with :
31+ context : .
32+ target : ${{ matrix.target }}
33+ push : true
34+ tags : |
35+ ghcr.io/${{ github.repository }}:${{ matrix.target }}-${{ github.sha }}
36+ ghcr.io/${{ github.repository }}:${{ matrix.target }}-edge
37+ platforms : linux/amd64
38+
39+ # ── Build migrate binaries ──
40+ migrate :
41+ runs-on : ubuntu-latest
42+ strategy :
43+ matrix :
44+ goos : [linux, darwin]
45+ goarch : [amd64, arm64]
46+ steps :
47+ - uses : actions/checkout@v4
48+
49+ - uses : actions/setup-go@v5
50+ with :
51+ go-version : ' 1.23'
52+
53+ - name : Build
54+ working-directory : vault
55+ env :
56+ GOTOOLCHAIN : local
57+ run : |
58+ GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=0 \
59+ go build -ldflags="-s -w" -o bin/migrate-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/migrate
60+
61+ - name : Upload artifact
62+ uses : actions/upload-artifact@v4
63+ with :
64+ name : migrate-${{ matrix.goos }}-${{ matrix.goarch }}
65+ path : vault/bin/migrate-*
66+ retention-days : 7
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const isAdmin = getAuthUser(pb)?.role === 'admin';
1818 <!-- Step 1: Extract → normalize to intermediate JSON -->
1919 <section class = " border border-[var(--color-border)] p-4" >
2020 <h2 class = " text-lg font-semibold mb-2" >步骤 1:提取数据 → 归一化 JSON</h2 >
21- <p class = " text-sm text-[var(--color-text-muted)] mb-3" >将旧 VanBlog 数据转换为统一的中间格式(V4 兼容 JSON)。选择以下任一方式:</p >
21+ <p class = " text-sm text-[var(--color-text-muted)] mb-3" >将旧 VanBlog 数据转换为统一的中间格式(新版 VanBlog 兼容 JSON)。选择以下任一方式:</p >
2222
2323 <details class = " mb-3" >
2424 <summary class = " cursor-pointer font-semibold text-sm" >🖥 从 MongoDB 数据目录提取(推荐,旧站无需运行)</summary >
@@ -51,9 +51,9 @@ chmod +x migrate
5151 <section class = " border border-[var(--color-border)] p-4" >
5252 <h2 class = " text-lg font-semibold mb-2" >步骤 2:导入归一化 JSON</h2 >
5353 <p class = " text-sm text-[var(--color-text-muted)] mb-3" >CLI 脚本自动完成此步骤。如果手动输出了 JSON 文件,可通过以下方式导入:</p >
54- <pre class = " overflow-x-auto bg-[var(--color-bg-secondary)] border border-[var(--color-border)] p-3 text-sm" ><code ># 方式 A:通过 V4 后台 (本页面上方上传)
54+ <pre class = " overflow-x-auto bg-[var(--color-bg-secondary)] border border-[var(--color-border)] p-3 text-sm" ><code ># 方式 A:通过后台 (本页面上方上传)
5555# 方式 B:通过 curl
56- curl -X POST http://your-v4 :8090/api/vanblog/migrate/import \\
56+ curl -X POST http://your-vanblog :8090/api/vanblog/migrate/import \\
5757 -H 'Content-Type: application/json' \\
5858 -d @temp.json</code ></pre >
5959 <p class = " text-sm text-[var(--color-text-muted)] mt-1" >导入 API 已内置数据校验和事务保护,失败自动回滚。</p >
Original file line number Diff line number Diff line change @@ -521,16 +521,16 @@ update() {
521521** 方式一:后台 JSON 导出(推荐)**
522522
5235231 . 在原 Vanblog 后台「系统设置 → 备份恢复」导出 ` temp.json `
524- 2 . 部署 VanBlog V4
525- 3 . V4 后台 → ** 迁移** → 上传 ` temp.json ` → 点击"开始导入"
524+ 2 . 部署新版 VanBlog
525+ 3 . 后台 → ** 迁移** → 上传 ` temp.json ` → 点击"开始导入"
5265264 . 导入完成后查看结果:文章/分类/标签/媒体数量,以及迁移档案文章
527527
528528** 方式二:CLI 直接提取(推荐,无需旧后台运行)**
529529
5305301 . 找到旧 VanBlog 的 MongoDB 数据目录(通常是 ` /var/vanblog/mongo/db/ ` )
5315312 . 运行迁移脚本:
532532 ``` bash
533- OLD_DATA=/var/vanblog/mongo/db TARGET=http://v4 :8090 ./scripts/vanblog-migrate.sh
533+ OLD_DATA=/var/vanblog/mongo/db TARGET=http://vanblog :8090 ./scripts/vanblog-migrate.sh
534534 ```
535535 或直接使用 Go CLI:
536536 ``` bash
@@ -539,7 +539,7 @@ update() {
539539
540540** 评论迁移(Waline → Artalk)**
541541
542- V4 迁移页内嵌了 Artransfer-CLI 使用指南。简要步骤:
542+ 迁移页内嵌了 Artransfer-CLI 使用指南。简要步骤:
543543
5445441 . 下载 [ Artransfer-CLI] ( https://github.com/ArtalkJS/Artransfer-CLI )
5455452 . ` ./artransfer waline --db=... --name=waline_db ` → 得到 ` .artrans ` 文件
Original file line number Diff line number Diff line change 11// Command migrate is an interactive CLI tool that reads data from an old
2- // VanBlog MongoDB database and imports it into a running V4 instance.
2+ // VanBlog MongoDB database and imports it into a running VanBlog instance.
33//
44// Usage:
55//
88// The program guides the user through three steps:
99// 1. Extract content data from old VanBlog MongoDB
1010// 2. (Optional) Waline → Artalk comment migration instructions
11- // 3. Import into a running VanBlog V4 instance
11+ // 3. Import into a running VanBlog instance
1212package main
1313
1414import (
You can’t perform that action at this time.
0 commit comments