Skip to content

Commit 9be4596

Browse files
authored
Merge pull request #135 from ether/fix/publish-workflow
ci: publish version from package.json (drop dirty-tree auto-bump)
2 parents feaf55e + edbe0bb commit 9be4596

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎.github/workflows/npmpublish.yml‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,20 @@ jobs:
6969
cache: pnpm
7070
registry-url: https://registry.npmjs.org/
7171
-
72-
name: Bump version (patch)
72+
name: Tag the version in package.json (if not already tagged)
7373
run: |
74-
LATEST_TAG=$(git describe --tags --abbrev=0) || exit 1
75-
NEW_COMMITS=$(git rev-list --count "${LATEST_TAG}"..) || exit 1
76-
[ "${NEW_COMMITS}" -gt 0 ] || exit 0
74+
PKG_VER=$(node -p "require('./package.json').version")
75+
if git rev-parse -q --verify "refs/tags/v${PKG_VER}" >/dev/null; then
76+
echo "v${PKG_VER} already tagged; nothing to do."
77+
exit 0
78+
fi
7779
git config user.name 'github-actions[bot]'
7880
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
79-
pnpm i
80-
pnpm version patch
81-
git push --follow-tags
81+
git tag "v${PKG_VER}"
82+
git push origin "v${PKG_VER}"
8283
-
83-
run: pnpm i
84+
run: pnpm i --frozen-lockfile
8485
-
85-
run: pnpm publish
86+
run: pnpm publish --no-git-checks
8687
env:
8788
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)