Skip to content

Commit bfb5d0a

Browse files
authored
Merge pull request #8 from CoderSerio/feat/carbon-dev
chore: enhance release workflow to check for existing tags before cre…
2 parents 6e212d1 + 088dc17 commit bfb5d0a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/Release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,16 @@ jobs:
144144
run: |
145145
npm config set provenance true
146146
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
147-
pnpm prepublishOnly
147+
# 读取 package.json 版本号,检查对应的 tag 是否已存在
148+
VERSION=$(node -p "require('./package.json').version")
149+
TAG="v$VERSION"
150+
if git rev-parse "$TAG" >/dev/null 2>&1; then
151+
echo "Tag $TAG already exists, skipping GitHub Release creation"
152+
pnpm napi prepublish -t npm --no-gh-release
153+
else
154+
echo "Tag $TAG does not exist, will create GitHub Release"
155+
pnpm prepublishOnly
156+
fi
148157
npm publish --access public
149158
env:
150159
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)