From 6dd771abaef90e23b22b543db515c78070c7c7da Mon Sep 17 00:00:00 2001 From: ozwaldorf Date: Tue, 11 Aug 2026 01:14:44 -0400 Subject: [PATCH] ci: require version ahead of the published npm release --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9a5280..184425b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,32 @@ concurrency: cancel-in-progress: true jobs: + version: + name: Version bump + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check version is ahead of npm + run: | + name=$(jq -r .name package.json) + local=$(jq -r .version package.json) + + # A package with no published release yet has nothing to be ahead of. + published=$(npm view "$name" version 2>/dev/null) || published="" + if [ -z "$published" ]; then + echo "$name is not published yet; skipping" + exit 0 + fi + + if [ -z "$(npx --yes semver -r ">$published" "$local")" ]; then + echo "::error file=package.json::version $local must be greater than the published $published" + exit 1 + fi + + echo "version bumped: $published -> $local" + build: name: Typecheck, test, build runs-on: ubuntu-latest