From 826ef5bc4c99681b27a9880195ad16c333058f7e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Mar 2026 13:24:04 +0000 Subject: [PATCH] chore: automate package.json version bump on release Automatically update package.json and package-lock.json version whenever a GitHub release is created, using the release tag name. Uses npm version --no-git-tag-version to avoid duplicate tags. Implements projectwallace/css-parser#190 --- .github/workflows/release.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 056c101..ee130ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: permissions: id-token: write # Required for OIDC - contents: read + contents: write jobs: publish-npm: @@ -23,5 +23,16 @@ jobs: - run: npm install -g npm@latest - run: npm ci --ignore-scripts --no-fund --no-audit - run: npm test + - name: Bump version + run: | + VERSION=${GITHUB_REF_NAME#v} + npm version $VERSION --no-git-tag-version + - name: Commit and push version bump + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add package.json package-lock.json + git commit -m "chore: bump version to ${GITHUB_REF_NAME#v}" + git push origin HEAD:main - run: npm run build - run: npm publish --access public