Skip to content

Commit 26948ee

Browse files
committed
ci(sdk): release commit survives codegen drift and keeps the lockfile in sync
The first release from the workflow published every package but could not push the version commit: the setup action's codegen had rewritten a tracked file from a live source, and git refused to rebase with that change unstaged. The rebase now autostashes. The release commit also refreshes bun.lock, which records the workspace versions, so main's frozen install keeps working after a bump. The publish script formats with bunx instead of npx, which stops npm's package-manager warnings on every package.
1 parent 3cb7dfc commit 26948ee

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎.github/workflows/sdks.yml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,12 @@ jobs:
150150
set -euo pipefail
151151
dir="$(bun -e 'const fs = require("fs"); for (const d of fs.readdirSync("packages/sdks")) { const p = `packages/sdks/${d}/package.json`; if (fs.existsSync(p) && require(`./${p}`).name === process.argv[1]) console.log(d) }' "$PACKAGE")"
152152
version="$(jq -r '.version | sub("-local$"; "")' "packages/sdks/$dir/package.json")"
153+
# The lockfile records the workspace versions, so main's frozen
154+
# install breaks without this.
155+
bun install
153156
git config user.name "github-actions[bot]"
154157
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
155-
git add packages/sdks apps/public/public/op1.js apps/public/public/op1-replay.js
158+
git add bun.lock packages/sdks apps/public/public/op1.js apps/public/public/op1-replay.js
156159
git commit -m "chore(sdk): release $PACKAGE $version" \
157160
-m "Released from the SDKs workflow ($BUMP bump). Dependent SDKs were released with it; see the package versions in this commit."
158161
git format-patch -1 --stdout > /tmp/sdk-release.patch
@@ -161,11 +164,13 @@ jobs:
161164
162165
# The packages are on npm by now, so this commit must land whatever
163166
# happened on main meanwhile: rebase onto the current tip, never force.
167+
# --autostash: the setup action's codegen rewrites a tracked file from a
168+
# live source, and that stray change must not block the rebase.
164169
- name: Push the release commit to main
165170
run: |
166171
set -euo pipefail
167172
git fetch origin main
168-
if ! git rebase origin/main; then
173+
if ! git rebase --autostash origin/main; then
169174
echo "::error::main moved during the release and the version commit conflicts with it. The packages are published; apply the sdk-release-commit artifact to main by hand."
170175
exit 1
171176
fi

‎tooling/publish/publish.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const workspacePath = (relativePath: string) =>
4747

4848
const savePackageJson = (absPath: string, data: PackageJson) => {
4949
fs.writeFileSync(absPath, JSON.stringify(data, null, 2), 'utf-8');
50-
execSync(`npx biome format ${absPath} --fix`);
50+
execSync(`bunx biome format ${absPath} --fix`);
5151
};
5252

5353
const exit = (message: string, error?: unknown) => {

0 commit comments

Comments
 (0)