Skip to content

Commit 0dd3bc0

Browse files
authored
Rename workflow and update version validation step
1 parent 72faf58 commit 0dd3bc0

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: npm publish
1+
name: npm-publish.yml
22

33
on:
44
release:
@@ -97,10 +97,12 @@ jobs:
9797
echo "package.json repository.url = $REPO"
9898
test "$REPO" = "git+https://github.com/albe/node-event-storage.git" \
9999
|| { echo "ERROR: repository.url must be git+https://github.com/albe/node-event-storage.git for npm OIDC trusted publishing"; exit 1; }
100-
- name: "Preflight: show ref + version"
100+
- name: "Preflight: validate version"
101101
run: |
102102
echo "GITHUB_REF=$GITHUB_REF"
103-
git describe --tags --always
104-
node -p "require('./package.json').version"
103+
VERSION="$(node -p "require('./package.json').version")"
104+
TAG="${{ inputs.tag || github.event.release.tag_name }}"
105+
echo "tag=$TAG version=$VERSION"
106+
test "v$VERSION" = "$TAG" || { echo "ERROR: Tag ($TAG) does not match package.json version (v$VERSION)"; exit 1; }
105107
- run: npm ci
106108
- run: npm publish --provenance --access public

0 commit comments

Comments
 (0)