Skip to content

Commit b48e4e6

Browse files
committed
fix(build): keep version stable during prepare-resources
1 parent e64009e commit b48e4e6

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ dev:
7373
pnpm run dev
7474

7575
build:
76+
@set -e; \
77+
build_version="$(ASTRBOT_DESKTOP_VERSION)"; \
78+
if [ -z "$$build_version" ]; then \
79+
build_version="$$(node -e "console.log(require('./package.json').version)")"; \
80+
fi; \
81+
ASTRBOT_SOURCE_GIT_URL="$(ASTRBOT_SOURCE_GIT_URL)" \
82+
ASTRBOT_SOURCE_GIT_REF="$(ASTRBOT_SOURCE_GIT_REF)" \
83+
ASTRBOT_DESKTOP_VERSION="$$build_version" \
7684
pnpm run build
7785

7886
rebuild: clean build

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ make prune
140140

141141
推荐日常使用 `make update`,避免本地切换分支导致版本漂移。
142142

143+
补充:`make build` 会默认使用当前 `package.json` 中的版本作为 `ASTRBOT_DESKTOP_VERSION`,避免构建前资源准备阶段把版本回写到其他值。若需覆盖,可显式传入 `ASTRBOT_DESKTOP_VERSION=...`
144+
143145
示例:
144146

145147
```bash

0 commit comments

Comments
 (0)