Revert "chore: make Lite edition support and related configurations hidden"

This reverts commit 88d5b303b8.
This commit is contained in:
wizardchen
2026-04-11 18:51:16 +08:00
committed by lyingbug
parent 46ff7a7d54
commit d005bd1db8
11 changed files with 1003 additions and 3 deletions
+246
View File
@@ -0,0 +1,246 @@
name: Release Lite Binaries
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Release tag (e.g. v0.2.0)"
required: true
concurrency:
group: release-lite-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
env:
GO_VERSION: "1.24"
NODE_VERSION: "22"
jobs:
# ── 1. Build frontend once, share as artifact ──
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Build frontend
working-directory: frontend
run: |
npm ci
npm run build
- uses: actions/upload-artifact@v4
with:
name: frontend-dist
path: frontend/dist/
retention-days: 1
# ── 2. Build Go binary per platform (native CGO) ──
build-binary:
needs: build-frontend
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
- os: ubuntu-24.04-arm
goos: linux
goarch: arm64
- os: macos-13
goos: darwin
goarch: amd64
- os: macos-14
goos: darwin
goarch: arm64
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- uses: actions/download-artifact@v4
with:
name: frontend-dist
path: web/
- name: Resolve version
id: ver
run: |
if [ -n "${{ inputs.tag }}" ]; then
VERSION="${{ inputs.tag }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Building ${VERSION} for ${{ matrix.goos }}/${{ matrix.goarch }}"
- name: Build
run: |
export EDITION=lite
eval "$(./scripts/get_version.sh env)"
LDFLAGS="-w -s $(./scripts/get_version.sh ldflags)"
export CGO_CFLAGS="-Wno-deprecated-declarations"
if [ "${{ matrix.goos }}" = "darwin" ]; then
export CGO_LDFLAGS="-Wl,-no_warn_duplicate_libraries"
fi
go build -tags "sqlite_fts5" -ldflags="${LDFLAGS}" \
-o WeKnora-lite ./cmd/server
- name: Package tarball
run: |
ARCHIVE="WeKnora-lite_${{ steps.ver.outputs.version }}_${{ matrix.goos }}_${{ matrix.goarch }}"
mkdir -p "${ARCHIVE}/web"
cp WeKnora-lite "${ARCHIVE}/"
cp -r web/* "${ARCHIVE}/web/"
cp .env.lite.example "${ARCHIVE}/"
cp docs/LITE.md "${ARCHIVE}/README.md"
if [ -d config ]; then
cp -r config "${ARCHIVE}/config"
fi
if [ -d migrations/sqlite ]; then
mkdir -p "${ARCHIVE}/migrations/sqlite"
cp -r migrations/sqlite/* "${ARCHIVE}/migrations/sqlite/"
fi
if [ -f deploy/weknora-lite.service ]; then
cp deploy/weknora-lite.service "${ARCHIVE}/"
fi
tar czf "${ARCHIVE}.tar.gz" "${ARCHIVE}"
shasum -a 256 "${ARCHIVE}.tar.gz" > "${ARCHIVE}.tar.gz.sha256"
- uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
WeKnora-lite_*.tar.gz
WeKnora-lite_*.tar.gz.sha256
retention-days: 3
# ── 3. Create GitHub Release ──
release:
needs: build-binary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: release-*
merge-multiple: true
- name: Resolve version
id: ver
run: |
if [ -n "${{ inputs.tag }}" ]; then
VERSION="${{ inputs.tag }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Generate release notes
id: notes
run: |
cat > notes.md << 'NOTES'
## WeKnora Lite ${{ steps.ver.outputs.version }}
单二进制部署,零外部依赖(无需 Docker / PostgreSQL / Redis)。
### 快速开始
```bash
# 1. 解压
tar xzf WeKnora-lite_${{ steps.ver.outputs.version }}_<os>_<arch>.tar.gz
cd WeKnora-lite_${{ steps.ver.outputs.version }}_<os>_<arch>
# 2. 配置
cp .env.lite.example .env.lite
# 编辑 .env.lite,至少确认 OLLAMA_BASE_URL 正确
# 3. 启动 Ollama(如尚未运行)
ollama serve &
ollama pull qwen2.5:7b
ollama pull nomic-embed-text
# 4. 运行
set -a && source .env.lite && set +a
./WeKnora-lite
# 访问 http://localhost:8080
```
### 平台支持
| 文件 | 平台 |
|------|------|
| `WeKnora-lite_*_linux_amd64.tar.gz` | Linux x86_64 |
| `WeKnora-lite_*_linux_arm64.tar.gz` | Linux ARM64 |
| `WeKnora-lite_*_darwin_amd64.tar.gz` | macOS Intel |
| `WeKnora-lite_*_darwin_arm64.tar.gz` | macOS Apple Silicon |
详细文档见 [LITE.md](docs/LITE.md)。
NOTES
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${{ steps.ver.outputs.version }}" \
--title "WeKnora Lite ${{ steps.ver.outputs.version }}" \
--notes-file notes.md \
WeKnora-lite_*.tar.gz \
WeKnora-lite_*.tar.gz.sha256
# ── 4. Update Homebrew Formula ──
update-homebrew:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve version
id: ver
run: |
if [ -n "${{ inputs.tag }}" ]; then
VERSION="${{ inputs.tag }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
- name: Wait for release assets to be available
run: sleep 15
- name: Update Formula
run: ./scripts/update-homebrew-formula.sh "${{ steps.ver.outputs.version }}"
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/weknora-lite.rb
if git diff --cached --quiet; then
echo "No changes to Formula"
else
git commit -m "formula: update weknora-lite to ${{ steps.ver.outputs.version }}"
git push origin main
fi