From 32261b6e0849a9a7ae41822226c9de0115d05e6a Mon Sep 17 00:00:00 2001 From: zzxwill Date: Fri, 23 Jan 2026 00:24:53 +0800 Subject: [PATCH] ci(release): add npm package version update to release workflow The release workflow now updates the npm package version in package.json to match the GitHub release tag. This ensures the npm package version stays synchronized with the GitHub releases when publishing to npm. --- .github/workflows/release.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9b905b..facd694 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,6 +38,7 @@ jobs: run: | VERSION=${GITHUB_REF#refs/tags/} echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "npm_version=${VERSION#v}" >> $GITHUB_OUTPUT TARBALL_URL="https://github.com/${{ github.repository }}/archive/refs/tags/$VERSION.tar.gz" SHA256=$(curl -sL "$TARBALL_URL" | sha256sum | cut -d' ' -f1) @@ -78,6 +79,11 @@ jobs: end EOF + - name: Update npm package version + run: | + NPM_VERSION=${{ steps.release.outputs.npm_version }} + node -e "const fs=require('fs');const p='package.json';const j=JSON.parse(fs.readFileSync(p,'utf8'));j.version='${NPM_VERSION}';fs.writeFileSync(p,JSON.stringify(j,null,2)+'\\n');" + - name: Commit and push Formula run: | git config --local user.email "action@github.com" @@ -88,7 +94,7 @@ jobs: git checkout -b "$BRANCH_NAME" - git add Formula/agentx.rb + git add Formula/agentx.rb package.json if git diff --staged --quiet; then echo "No changes to commit"