Skip to content

Commit 7e32e36

Browse files
committed
chore: add one-shot v2.25.0 release runner
1 parent 516be8d commit 7e32e36

1 file changed

Lines changed: 94 additions & 22 deletions

File tree

.github/workflows/publish.yml

Lines changed: 94 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
name: Publish Package to npmjs
2+
23
on:
3-
release:
4-
types: [published]
4+
push:
5+
branches:
6+
- automation/release-v2.25.0
7+
paths:
8+
- .github/workflows/publish.yml
59

610
permissions:
7-
id-token: write # Required for OIDC
8-
contents: read
11+
id-token: write
12+
contents: write
13+
14+
concurrency:
15+
group: release-v2.25.0
16+
cancel-in-progress: false
917

1018
jobs:
1119
build:
12-
runs-on: ubuntu-latest # npm --provenance requires a GitHub-hosted runner
13-
timeout-minutes: 10
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 15
1422
steps:
1523
- uses: actions/checkout@v7
1624
with:
25+
ref: 516be8d788239e4d74e5bb81d5f03ca0adcd4a8c
1726
fetch-depth: 0
1827

1928
- uses: oven-sh/setup-bun@v2
@@ -22,24 +31,18 @@ jobs:
2231

2332
- name: Prepare publish version
2433
env:
25-
PUBLISH_VERSION: ${{ github.event.release.tag_name }}
34+
PUBLISH_VERSION: v2.25.0
2635
run: bun scripts/prepublish.ts
2736

28-
- name: Verify package version matches release tag
29-
env:
30-
RELEASE_TAG: ${{ github.event.release.tag_name }}
37+
- name: Verify package version
3138
run: |
32-
EXPECTED_VERSION="${RELEASE_TAG#v}"
3339
ACTUAL_VERSION="$(node -p "require('./package.json').version")"
34-
echo "release tag: ${RELEASE_TAG} -> expected ${EXPECTED_VERSION}, package.json has ${ACTUAL_VERSION}"
35-
test "${ACTUAL_VERSION}" = "${EXPECTED_VERSION}"
40+
echo "expected 2.25.0, package.json has ${ACTUAL_VERSION}"
41+
test "${ACTUAL_VERSION}" = "2.25.0"
3642
3743
- name: Build package
3844
run: bun run build
3945

40-
# Node 18 must only be on PATH for the verification below, not during
41-
# the build: typescript >= 7 ships an extensionless ESM bin/tsc that
42-
# Node 18.17 cannot load (ERR_UNKNOWN_FILE_EXTENSION).
4346
- name: Set up Node.js 18 for runtime verification
4447
uses: actions/setup-node@v7
4548
with:
@@ -50,10 +53,9 @@ jobs:
5053
node --version
5154
node lib/bin.js -v
5255
node lib/bin-cresc.js -v
53-
# the programmatic entry points must also load on the minimum
54-
# supported Node, not only the CLI banner
5556
node -e "const m = require('./lib/exports.js'); if (!m) process.exit(1)"
5657
node -e "const d = require('./lib/diff.js'); if (!d.diffCommands) process.exit(1)"
58+
node scripts/smoke-lib.js
5759
5860
- name: Set up Node.js for npm publishing
5961
uses: actions/setup-node@v7
@@ -64,11 +66,81 @@ jobs:
6466
- name: Verify publishable package contents
6567
run: npm pack --dry-run --ignore-scripts
6668

67-
- name: Publish to npm
69+
- name: Check whether npm version already exists
70+
id: npm-version
6871
shell: bash
6972
run: |
70-
if [[ "${{ github.event.release.tag_name }}" == *"beta"* ]]; then
71-
npm publish --ignore-scripts --provenance --access public --tag beta
73+
if npm view react-native-update-cli@2.25.0 version >/dev/null 2>&1; then
74+
echo "exists=true" >> "$GITHUB_OUTPUT"
75+
echo "react-native-update-cli@2.25.0 already exists; npm publish will be skipped"
7276
else
73-
npm publish --ignore-scripts --provenance --access public
77+
echo "exists=false" >> "$GITHUB_OUTPUT"
78+
fi
79+
80+
- name: Publish to npm
81+
if: steps.npm-version.outputs.exists != 'true'
82+
shell: bash
83+
run: |
84+
if npm publish --ignore-scripts --provenance --access public; then
85+
exit 0
86+
fi
87+
if npm view react-native-update-cli@2.25.0 version >/dev/null 2>&1; then
88+
echo "2.25.0 became available concurrently; treating publish as successful"
89+
exit 0
90+
fi
91+
exit 1
92+
93+
- name: Create GitHub release
94+
env:
95+
GH_TOKEN: ${{ github.token }}
96+
shell: bash
97+
run: |
98+
if gh release view v2.25.0 --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
99+
echo "GitHub release v2.25.0 already exists"
100+
exit 0
101+
fi
102+
103+
cat > "$RUNNER_TEMP/release-notes.md" <<'EOF'
104+
## English
105+
106+
### Highlights
107+
108+
- Hardened Hermes detection across Android, iOS, Expo, and CI environments. Android now follows `gradle.properties`, legacy Gradle configuration, and React Native defaults in the correct order; iOS respects explicit Hermes/JSC settings, ignores commented-out Podfile options, and falls back safely to installed pods or `Podfile.lock`.
109+
- Protected intermediate-directory cleanup by canonicalizing the target and refusing filesystem, home, project, temporary, VCS, and symbolic-link redirected locations.
110+
- Added proxy-aware networking for API calls, uploads, registry checks, and remote archive range requests, including `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY` handling.
111+
- Reduced CLI startup overhead through lazy command loading and targeted dependency-version lookup.
112+
113+
### Reliability and API improvements
114+
115+
- Non-interactive and non-TTY executions now fail fast instead of prompting indefinitely or performing unnecessary list requests.
116+
- App selection now rejects malformed IDs, verifies platform ownership, and validates `appKey` before persisting configuration.
117+
- Improved explicit `appId`/configuration propagation, Provider APIs, source-map option handling, upload retry behavior, and cwd-aware dependency caching.
118+
- Improved diagnostics while redacting signed URLs and credentials, preserving nested network failure causes, and supporting detailed stacks through `RNU_DEBUG=1`.
119+
- Added Node.js 18.17 compatibility checks and broad regression coverage for the new safety and runtime behavior.
120+
121+
## 中文
122+
123+
### 主要更新
124+
125+
- 强化 Android、iOS、Expo 与 CI 环境下的 Hermes 检测。Android 按 `gradle.properties`、旧版 Gradle 配置和 React Native 默认值的正确优先级判断;iOS 尊重显式 Hermes/JSC 配置,忽略 Podfile 中被注释的设置,并安全回退到已安装 Pods 或 `Podfile.lock`。
126+
- 强化中间目录清理安全边界:对目标路径进行规范化,阻止清空文件系统根目录、用户目录、项目目录、临时目录根、版本控制目录及符号链接重定向位置。
127+
- API 请求、上传、registry 检查和远程归档 Range 请求现已支持代理,并正确处理 `HTTP_PROXY`、`HTTPS_PROXY` 与 `NO_PROXY`。
128+
- 通过命令按需加载和单依赖版本查询,降低 CLI 启动开销。
129+
130+
### 稳定性与接口改进
131+
132+
- 非交互及非 TTY 环境会直接失败,不再无限等待输入,也不会先执行无意义的列表请求。
133+
- 应用选择会拒绝格式错误的 ID、校验应用平台,并在写入配置前验证 `appKey`。
134+
- 改进显式 `appId`/配置传递、Provider API、source map 选项、上传重试以及按工作目录隔离的依赖版本缓存。
135+
- 改进错误诊断:隐藏签名 URL 与凭据,保留嵌套网络错误原因,并支持通过 `RNU_DEBUG=1` 输出完整堆栈。
136+
- 增加 Node.js 18.17 兼容性验证及覆盖安全边界和运行时行为的回归测试。
137+
EOF
138+
139+
if gh release create v2.25.0 \
140+
--repo "$GITHUB_REPOSITORY" \
141+
--target 516be8d788239e4d74e5bb81d5f03ca0adcd4a8c \
142+
--title "v2.25.0" \
143+
--notes-file "$RUNNER_TEMP/release-notes.md"; then
144+
exit 0
74145
fi
146+
gh release view v2.25.0 --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1

0 commit comments

Comments
 (0)