Skip to content

Commit fee2378

Browse files
authored
fix(ci): fix crates.io publish + add verification (#1126)
## Summary - **Fix bashkit core publish**: Strip python feature from bashkit-cli before publishing bashkit core (cargo resolves whole workspace) - **Remove silent error swallowing**: `cargo publish` failures were hidden by `|| echo "::warning::"` — bashkit core 0.1.16 silently failed to publish to crates.io - **Add publish verification**: New `verify-publish` job in publish.yml checks crates.io, npm verification step in publish-js.yml - **Update release spec**: Add post-release verification section with manual check commands ## Context v0.1.16 published to npm and PyPI but **not** to crates.io. The `cargo publish -p bashkit` step failed because cargo resolves the whole workspace, and bashkit-cli still referenced `bashkit` with `features = ["python"]` (which was stripped). The error was swallowed by `|| echo "::warning::"`. ## Test plan - [ ] CI green - [ ] After merge, manually re-trigger `publish.yml` to publish bashkit 0.1.16 to crates.io - [ ] Verify crates.io shows bashkit 0.1.16
1 parent ce7764a commit fee2378

File tree

3 files changed

+87
-10
lines changed

3 files changed

+87
-10
lines changed

.github/workflows/publish-js.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,17 @@ jobs:
424424
working-directory: crates/bashkit-js
425425
env:
426426
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
427+
428+
- name: Verify npm publish
429+
run: |
430+
sleep 10
431+
PKG_VERSION=$(node -p "require('./package.json').version")
432+
ACTUAL=$(npm view @everruns/bashkit version 2>/dev/null || echo "not found")
433+
if [ "$ACTUAL" = "$PKG_VERSION" ]; then
434+
echo "✓ @everruns/bashkit@$ACTUAL published to npm (latest)"
435+
else
436+
echo "✗ expected $PKG_VERSION on npm latest, got $ACTUAL"
437+
echo "::error::npm publish verification failed"
438+
exit 1
439+
fi
440+
working-directory: crates/bashkit-js

.github/workflows/publish.yml

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,27 @@ jobs:
3939
fi
4040
4141
- name: Strip git-only dependencies for publishing
42-
# monty is a git dep (not yet on crates.io) — remove before publish
42+
# monty is a git dep (not yet on crates.io) — remove before publish.
43+
# Must strip from both bashkit AND bashkit-cli because cargo resolves
44+
# the whole workspace when publishing a single crate.
4345
run: |
46+
# --- bashkit core ---
4447
TOML=crates/bashkit/Cargo.toml
45-
# Remove monty dependency line
4648
sed -i '/^monty = .*/d' "$TOML"
47-
# Remove python feature that references monty
4849
sed -i '/^python = \["dep:monty"\]/d' "$TOML"
49-
# Remove python_scripts example block (requires python feature)
5050
sed -i '/^\[\[example\]\]/{N;N;/python_scripts/d}' "$TOML"
51-
echo "--- Cargo.toml after stripping ---"
51+
echo "--- bashkit Cargo.toml after stripping ---"
5252
cat "$TOML"
5353
54+
# --- bashkit-cli (workspace resolution requires this too) ---
55+
CLI_TOML=crates/bashkit-cli/Cargo.toml
56+
sed -i '/^python = \["bashkit\/python"\]/d' "$CLI_TOML"
57+
sed -i 's/default = \["python"\]/default = []/' "$CLI_TOML"
58+
echo "--- bashkit-cli Cargo.toml after stripping ---"
59+
cat "$CLI_TOML"
60+
5461
- name: Publish bashkit to crates.io
55-
run: cargo publish -p bashkit --allow-dirty 2>&1 || echo "::warning::bashkit publish failed (may already exist)"
62+
run: cargo publish -p bashkit --allow-dirty
5663
env:
5764
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
5865

@@ -84,3 +91,37 @@ jobs:
8491
run: cargo publish -p bashkit-cli --allow-dirty
8592
env:
8693
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
94+
95+
# ============================================================================
96+
# Verify all packages were published successfully
97+
# ============================================================================
98+
verify-publish:
99+
name: Verify published versions
100+
runs-on: ubuntu-latest
101+
needs: [publish-bashkit, publish-bashkit-cli]
102+
steps:
103+
- uses: actions/checkout@v6
104+
105+
- name: Wait for crates.io propagation
106+
run: sleep 60
107+
108+
- name: Verify crates.io versions
109+
run: |
110+
EXPECTED=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
111+
echo "Expected version: $EXPECTED"
112+
PASS=true
113+
114+
for CRATE in bashkit bashkit-cli; do
115+
ACTUAL=$(curl -s "https://crates.io/api/v1/crates/$CRATE" | python3 -c "import sys,json; print(json.load(sys.stdin)['crate']['max_version'])")
116+
if [ "$ACTUAL" = "$EXPECTED" ]; then
117+
echo "✓ $CRATE@$ACTUAL on crates.io"
118+
else
119+
echo "✗ $CRATE: expected $EXPECTED, got $ACTUAL"
120+
PASS=false
121+
fi
122+
done
123+
124+
if [ "$PASS" = "false" ]; then
125+
echo "::error::Some crates.io packages were not published correctly"
126+
exit 1
127+
fi

specs/008-release-process.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ When asked to create a release, the agent:
7676
- Extracts release notes from CHANGELOG.md
7777
- Creates GitHub Release with tag `vX.Y.Z`
7878

79-
**On GitHub Release published** (publish.yml):
80-
- Publishes to crates.io in dependency order
81-
- Note: No verification step - CI already ran when PR merged to main
79+
**On GitHub Release published** (publish.yml, publish-js.yml, publish-python.yml):
80+
- Publishes to crates.io, npm, and PyPI
81+
- Each publish workflow includes a verification step that checks the published version matches expectations
8282

8383
## Pre-Release Checklist
8484

@@ -199,7 +199,7 @@ brew install everruns/tap/bashkit
199199
### publish.yml
200200

201201
- **Trigger**: GitHub Release published
202-
- **Actions**: Publishes to crates.io (no verification - CI ran on merge)
202+
- **Actions**: Publishes to crates.io in dependency order, then verifies published versions
203203
- **File**: `.github/workflows/publish.yml`
204204
- **Secret required**: `CARGO_REGISTRY_TOKEN`
205205

@@ -294,6 +294,28 @@ Done. PR created: https://github.com/everruns/bashkit/pull/XX
294294
Please review and merge to trigger the release.
295295
```
296296

297+
## Post-Release Verification
298+
299+
Each publish workflow includes automated verification. After a release, the agent (or human) should also verify manually:
300+
301+
```bash
302+
# crates.io
303+
cargo search bashkit # Should show latest version
304+
cargo search bashkit-cli # Should show latest version
305+
306+
# npm
307+
npm view @everruns/bashkit version # Should show latest version
308+
npm dist-tags ls @everruns/bashkit # "latest" should point to new version
309+
310+
# PyPI
311+
pip index versions bashkit # Should show latest version
312+
313+
# GitHub
314+
gh release view --repo everruns/bashkit # Should show latest tag
315+
```
316+
317+
If any registry is missing the new version, check the corresponding publish workflow run for errors.
318+
297319
## Hotfix Releases
298320

299321
For urgent fixes:

0 commit comments

Comments
 (0)