fix(ci): make RN alpha publication deterministic

这个提交包含在:
XuqmGroup 2026-07-17 13:57:02 +08:00
父节点 a902e30e0a
当前提交 fed3fd4fc4
共有 3 个文件被更改,包括 18 次插入4 次删除

2
.gitattributes vendored 普通文件
查看文件

@ -0,0 +1,2 @@
* text=auto eol=lf
*.bat text eol=crlf

14
Jenkinsfile vendored
查看文件

@ -83,8 +83,13 @@ pipeline {
def newVer
if (params.SNAPSHOT) {
// SNAPSHOT查询 registry 上最新的 alpha 版本,自动递增
def alphaNum = 1
// SNAPSHOT源码与 registry 都可能领先,必须取二者最大序号再递增。
def localAlphaNum = 0
def localMatcher = (currentVer =~ /-alpha\.(\d+)$/)
if (localMatcher.find()) {
localAlphaNum = localMatcher.group(1).toInteger()
}
def remoteAlphaNum = 0
try {
def remoteVer = bat(
script: "@npm view ${pkg} dist-tags.alpha --registry %NEXUS_REGISTRY% 2>nul",
@ -93,12 +98,13 @@ pipeline {
if (remoteVer && remoteVer.matches(/.*-alpha\.\d+$/)) {
def matcher = (remoteVer =~ /-alpha\.(\d+)$/)
if (matcher.find()) {
alphaNum = matcher.group(1).toInteger() + 1
remoteAlphaNum = matcher.group(1).toInteger()
}
}
} catch (Exception e) {
echo "Could not query remote version for ${pkg}, using alpha.1"
echo "Could not query remote version for ${pkg}; advancing from source version"
}
def alphaNum = Math.max(localAlphaNum, remoteAlphaNum) + 1
newVer = baseVer + "-alpha.${alphaNum}"
echo "SNAPSHOT publish: ${pkg} → ${newVer} (tag: alpha)"
// 临时写入 package.json 供 npm publish 读取(不 commit

查看文件

@ -101,6 +101,12 @@ pnpm --dir packages/update test
## 7. 本轮变更记录
### 2026-07-17 / Jenkins #48 失败修复
- `sdk-rn-publish #48` 在 Windows 棡出后因 8 个文件换行不一致被 Prettier 正确阻断,未发布任何包。
- 新增 `.gitattributes`,源码统一以 LF 检出;仅 `.bat` 保持 CRLF。
- alpha 版本号改为取源码现有序号与 Nexus 远端序号的最大值后加一,禁止版本倒退和重复发布。
### 2026-07-17 / common 第一轮
- 引入 `semver@7.8.5``@types/semver@7.7.1`,不自行重复实现版本算法。