Skip to content

Commit 67c5bc8

Browse files
committed
check package.json version
1 parent 3edbedc commit 67c5bc8

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,23 @@ jobs:
2323

2424
- name: Determine pre-release tag
2525
run: |
26-
TAG_NAME=${GITHUB_REF#refs/tags/}
26+
TAG_NAME=${GITHUB_REF_NAME}
2727
echo "Detected tag: $TAG_NAME"
2828
if [[ "$TAG_NAME" == *-alpha.* ]]; then
2929
echo "tag=alpha" >> $GITHUB_ENV
3030
else
3131
echo "tag=latest" >> $GITHUB_ENV
3232
fi
3333
34+
- name: Verify version matches tag
35+
run: |
36+
PKG_VERSION=$(node -p "require('./package.json').version")
37+
TAG_VERSION=${GITHUB_REF_NAME#v}
38+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
39+
echo "::error::package.json version ($PKG_VERSION) does not match tag ($TAG_VERSION)"
40+
exit 1
41+
fi
42+
3443
- name: Install dependencies
3544
run: npm ci
3645

0 commit comments

Comments
 (0)