File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,7 +109,17 @@ jobs:
109109 run : if grep -q '"build"' package.json; then ${{ steps.pm.outputs.pm }} build; else echo "No build script found, skipping"; fi
110110
111111 - name : Set version from Git
112- run : npm version from-git --no-git-tag-version
112+ run : |
113+ if git describe --tags --abbrev=0 --match='*.*.*' 2>/dev/null; then
114+ npm version from-git --no-git-tag-version
115+ elif [ "$DRY_RUN" = "true" ]; then
116+ echo "No semver tags found, keeping version from package.json (dry-run)"
117+ else
118+ echo "::error::No semver tags found. Cannot publish without a version tag."
119+ exit 1
120+ fi
121+ env :
122+ DRY_RUN : ${{ inputs.dry_run }}
113123
114124 - name : Log package version
115125 run : |
@@ -165,6 +175,9 @@ jobs:
165175 IS_PRERELEASE : ${{ github.event.release.prerelease }}
166176 REPO_VISIBILITY : ${{ github.event.repository.visibility }}
167177
168- - name : Skip publishing (dry -run mode)
178+ - name : Dry -run publish
169179 if : ${{ inputs.dry_run }}
170- run : echo "Dry-run mode enabled. Skipping npm publish."
180+ run : |
181+ VERSION=$(node -p "require('./package.json').version")
182+ echo "Dry-run validating package at version: $VERSION"
183+ npm pack --dry-run
You can’t perform that action at this time.
0 commit comments