Skip to content

Commit 1861b43

Browse files
committed
fix: release workflow and package metadata
- Update NPM version check logic to use explicit package name and version for reliable publication skipping. - Convert bin and repository to object format in package.json to meet NPM standards and define the CLI command name.
1 parent 888610a commit 1861b43

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ jobs:
2828

2929
- name: Publish to NPM (Trusted Publishing)
3030
# It will only publish if the version in package.json is new
31+
# Note: Trusted Publishing requires permissions: id-token: write
3132
run: |
32-
if npm view . version | grep -q $(node -p "require('./package.json').version"); then
33-
echo "Version already exists on NPM. Skipping publish."
33+
PACKAGE_NAME=$(node -p "require('./package.json').name")
34+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
35+
if npm view "$PACKAGE_NAME" version | grep -q "$PACKAGE_VERSION"; then
36+
echo "Version $PACKAGE_VERSION already exists on NPM. Skipping publish."
3437
else
3538
npm publish --provenance --access public
3639
fi

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@
66
"files": [
77
"dist"
88
],
9-
"bin": "./dist/main.js",
10-
"repository": "https://github.com/fastone-open/docusaurus-docs-to-pdf.git",
9+
"bin": {
10+
"docusaurus-docs-to-pdf": "dist/main.js"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/fastone-open/docusaurus-docs-to-pdf.git"
15+
},
1116
"author": "Xiangcheng Kuo <xiangcheng.guo@fastonetech.com>",
1217
"license": "MIT",
1318
"devDependencies": {

0 commit comments

Comments
 (0)