修复发行构建工具链版本来源
Some checks are pending
Security Checks / security (push) Waiting to run

This commit is contained in:
smail 2026-09-17 18:23:40 +08:00
parent 9f65c60600
commit 3fd8facbdb
2 changed files with 2 additions and 1 deletions

View File

@ -1,7 +1,7 @@
SMAIL_VERSION ?= $(shell git describe --tags --always --dirty)
GIT_HASH ?= $(shell git show -s --format=%H)
BUILD_TIME ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
GO_VERSION ?= $(shell go version)
GO_VERSION ?= $(shell cd backend && go version)
BUILD_LDFLAGS = -s -w -X 'git.pcux.cn/xuans/Smail/internal/buildinfo.Version=$(SMAIL_VERSION)' -X 'git.pcux.cn/xuans/Smail/internal/buildinfo.GitHash=$(GIT_HASH)' -X 'git.pcux.cn/xuans/Smail/internal/buildinfo.BuildTime=$(BUILD_TIME)' -X 'git.pcux.cn/xuans/Smail/internal/buildinfo.GoVersion=$(GO_VERSION)'
.PHONY: build clean clean_codex_test_artifacts build_fe build_server wechat_push spam_block telegram_push plugin package test test_mysql test_postgres

View File

@ -11,6 +11,7 @@ const read = relative => readFile(path.join(root, relative), 'utf8')
test('跨平台构建输出不得越过项目 out 目录', async () => {
const content = await read('Makefile')
assert.match(content, /GO_VERSION \?= \$\(shell cd backend && go version\)/)
const commands = [...content.matchAll(/cd ([^\s]+) && [^\n]*go build [^\n]* -o ([^\s]+) /g)]
assert.equal(commands.length, 12)
for (const [, directory, output] of commands) {