Tự động hóa phát hành
Phát hành Libre WebUI được tạo từ gốc kho bằng tập lệnh phát hành. Tập lệnh đọc lịch sử Git từ tag trước, cập nhật phiên bản, ghi nhật ký, chạy kiểm tra, tạo commit và tag. GitHub là nguồn build và tệp nhị phân; metadata và liên kết hiện vật được sao chép sang Forgejo.
Thiết lập một lần
npm install
npm run setup-hooks
.githooks/commit-msgkiểm tra Conventional Commit.githooks/pre-commitkiểm tra định dạng.gitmessagelàm mẫu commit
Tạo phát hành
# Patch release
npm run release
# Minor release
npm run release:minor
# Major release
npm run release:major
Tập lệnh kiểm tra cây sạch, thu thập bằng chứng, tạo ghi chú, cập nhật package.json, tệp workspace, package-lock.json, Helm và CHANGELOG.md, chạy npm run release:check, rồi mới tạo commit/tag.
Tạo nhật ký
npm run changelog
npm run changelog -- update
Trình tạo có thể dùng mô hình Ollama cục bộ rồi xác minh với bằng chứng Git. Nếu AI không khả dụng, dùng trình xác định.
CHANGELOG_AI=0 npm run release:minor
CHANGELOG_AI_MODEL=glm-5.2:cloud npm run changelog
OLLAMA_BASE_URL=http://127.0.0.1:11434 npm run release
Đẩy phát hành
Chỉ đẩy commit và tag được tập lệnh chỉ định. Đẩy Forgejo trước, GitHub sau:
git -c push.followTags=false push \
https://git.kroonen.ai/libre-webui/libre-webui.git \
HEAD:refs/heads/main
git ls-remote \
https://git.kroonen.ai/libre-webui/libre-webui.git \
refs/heads/main
git -c push.followTags=false push \
https://github.com/libre-webui/libre-webui.git \
HEAD:refs/heads/main
git ls-remote \
https://github.com/libre-webui/libre-webui.git \
refs/heads/main
Hai SHA phải khớp commit cục bộ. Chờ luồng GitHub thành công trước khi đẩy tag.
git ls-remote \
https://git.kroonen.ai/libre-webui/libre-webui.git \
'refs/tags/vX.Y.Z' 'refs/tags/vX.Y.Z^{}'
git ls-remote \
https://github.com/libre-webui/libre-webui.git \
'refs/tags/vX.Y.Z' 'refs/tags/vX.Y.Z^{}'
git -c push.followTags=false push \
https://git.kroonen.ai/libre-webui/libre-webui.git \
refs/tags/vX.Y.Z:refs/tags/vX.Y.Z
git -c push.followTags=false push \
https://github.com/libre-webui/libre-webui.git \
refs/tags/vX.Y.Z:refs/tags/vX.Y.Z
git ls-remote \
https://git.kroonen.ai/libre-webui/libre-webui.git \
'refs/tags/vX.Y.Z' 'refs/tags/vX.Y.Z^{}'
git ls-remote \
https://github.com/libre-webui/libre-webui.git \
'refs/tags/vX.Y.Z' 'refs/tags/vX.Y.Z^{}'
Thay vX.Y.Z. Không dùng git push --tags.
Luồng CI
Tag v* chạy npm run release:check, build Electron, tạo GitHub Release, sao chép Forgejo, build Docker, phát hành Helm và npm bằng NPM_TOKEN.
npm run release:check
Bản sao Forgejo
Dùng bí mật FORGEJO_TOKEN chỉ với write:repository cho kho libre-webui/libre-webui. Không ghi hoặc in token. Bản sao có tính lặp an toàn: chỉ tạo phần thiếu và bỏ qua phần có sẵn.
Tài sản Forgejo là liên kết đến GitHub browser_download_url; GitHub vẫn lưu nhị phân.
Xem hoặc bổ sung một phát hành
node scripts/mirror-forgejo-releases.mjs --tag vX.Y.Z --dry-run
node scripts/mirror-forgejo-releases.mjs --tag vX.Y.Z
Xem hoặc bổ sung tất cả
node scripts/mirror-forgejo-releases.mjs --all --dry-run
node scripts/mirror-forgejo-releases.mjs --all
--all cần GITHUB_TOKEN; không dùng --dry-run còn cần FORGEJO_TOKEN. Chỉ đối chiếu GitHub Release, không phải mọi tag.
Chính sách tag bất biến
Sau khi tag được xuất bản:
- Không xóa.
- Không force-push.
- Không di chuyển.
- Không tái sử dụng phiên bản.
Nếu sai, phát hành patch mới. Tag Forgejo v0.8.6 từng được điều chỉnh một lần có phê duyệt; đó không phải tiền lệ.
Chính sách phiên bản Helm
version, appVersion, phiên bản gói và tag dùng cùng phiên bản ngữ nghĩa. Chart chỉ phát hành từ tag v* bất biến. Bản 0.14.1 có ghi đè digest một lần. Docker Hub/GHCR nhận cùng tag; Helm chờ tối đa 20 phút. Ollama dùng latest riêng.
Conventional Commits
Thay đổi phá vỡ tương thích dùng dấu !. Nhánh sản xuất là main.
<type>[optional scope]: <description>
feat,fix,docs,refactor,perf,test,chore
git commit -m "feat!: remove deprecated endpoint"
git commit -m "fix(auth)!: change token validation"
Khắc phục sự cố
Cây làm việc bẩn
git status --short
git add .
git commit -m "fix: resolve pending changes"
Không có thay đổi
git log $(git describe --tags --abbrev=0)..HEAD --oneline
Sửa nhật ký
git add CHANGELOG.md
git commit -m "docs: refine changelog"
Hoàn tác commit cục bộ
git tag -d v0.12.0
git reset --soft HEAD~1
Không xóa tag đã đẩy; tạo patch mới.
Bản sao không đầy đủ
node scripts/mirror-forgejo-releases.mjs --tag vX.Y.Z --dry-run
node scripts/mirror-forgejo-releases.mjs --tag vX.Y.Z
Lỗi quyền thường do FORGEJO_TOKEN thiếu, hết hạn hoặc thiếu write:repository.
Tệp bảo trì
.gitmessage.githooks/commit-msg.githooks/pre-commitscripts/release.jsscripts/mirror-forgejo-releases.mjsscripts/generate-changelog.jsscripts/lib/releaseNotes.js.github/workflows/release.yml.github/workflows/helm-publish.yml