Skip to content

Commit d9de7de

Browse files
authored
ci(npm-publish): refresh README ecosystem footer on release (#157)
Fetch docs-kit's standalone README updater from the private repo and run\nit during the version bump (after pnpm version, before the commit), folding\nREADME.md into the signed version-bump commit. Best-effort: a failed fetch\nor roster blip only warns.\n\nCo-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent edbb620 commit d9de7de

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,16 +460,33 @@ jobs:
460460
;;
461461
esac
462462
463-
# Get the new version number
464-
NEW_VERSION=$(pnpm version "$BUMP_TYPE" --no-git-tag-version)
465-
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
463+
# Mutate package.json only — do NOT parse pnpm stdout (pnpm 11 prints multi-line text)
464+
pnpm version "$BUMP_TYPE" --no-git-tag-version
465+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
466+
NEW_VERSION="v${PACKAGE_VERSION}"
467+
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
466468
467469
# Escape special characters in PR title and URL
468470
ESCAPED_TITLE=$(echo "$PR_TITLE" | sed 's/[`$"\]/\\&/g')
469471
ESCAPED_URL=$(echo "$PR_URL" | sed 's/[`$"\]/\\&/g')
470472
471-
# Commit the version changes
472-
git add package.json
473+
# Refresh the managed README footer (the docs-kit ecosystem block +
474+
# standardized License/Credits). Runs AFTER `pnpm version` so the
475+
# working tree is clean when pnpm runs — pnpm version aborts on a
476+
# dirty tree. Fetched raw from the private docs-kit repo (no install,
477+
# no dependency here); reuses $GITHUB_TOKEN (ACTIONS_KEY) for auth.
478+
# Best-effort: a failed fetch or roster blip only warns.
479+
UPDATER="$RUNNER_TEMP/update-ecosystem-readme.mjs"
480+
if curl -fsSL -H "Authorization: token $GITHUB_TOKEN" \
481+
https://raw.githubusercontent.com/humanspeak/docs-kit/main/scripts/update-ecosystem-readme.mjs \
482+
-o "$UPDATER"; then
483+
node "$UPDATER" || echo "::warning::ecosystem updater errored; README left unchanged"
484+
else
485+
echo "::warning::could not fetch ecosystem updater; skipping README refresh"
486+
fi
487+
488+
# Commit the version changes (and any refreshed README ecosystem block)
489+
git add package.json README.md
473490
git commit -m "Bump version to ${NEW_VERSION} [skip ci]"
474491
475492
# Create an annotated tag with release notes

0 commit comments

Comments
 (0)