Skip to content

Commit d4209b7

Browse files
saadhtiwanaviccuad
andauthored
Add version verification step before npm publish (#257)
* Add version verification step before npm publish Add a step that checks if the git tag matches the package.json version. Stops the release if versions don’t match. Fixes issue #226. Signed-off-by: Malik Saad Hayat <[email protected]> * Fix accidental changes to setFailed and restore whitespace. Thanks for the quick review @viccuad! You're absolutely right - I accidentally removed a parenthesis and some whitespace. I've just pushed a fix to restore: - The `(` in `core.setFailed()` on line 41 - The empty lines/spacing throughout the file The version verification check remains unchanged. Should be good to go now! Signed-off-by: Malik Saad Hayat <[email protected]> * Fix accidental changes to setFailed and restore whitespace. Thanks for the review @viccuad! I've fixed the accidental changes: - Restored the `(` in `core.setFailed()` on line 41 - Restored the empty lines/whitespace throughout the file The version verification step remains unchanged. Ready for another look! Signed-off-by: Malik Saad Hayat <[email protected]> --------- Signed-off-by: Malik Saad Hayat <[email protected]> Co-authored-by: Víctor Cuadrado Juan <[email protected]>
1 parent e8e13e9 commit d4209b7

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,14 @@ jobs:
7878
run: |
7979
#!/bin/bash
8080
set -e
81-
8281
INSTALL_DIR=$HOME/.javy
8382
VERSION="v7.0.1"
84-
8583
mkdir -p $INSTALL_DIR
8684
curl -sL https://github.com/bytecodealliance/javy/releases/download/${VERSION}/javy-x86_64-linux-${VERSION}.gz -o $INSTALL_DIR/javy.gz
8785
gzip -d -c $INSTALL_DIR/javy.gz > $INSTALL_DIR/javy
8886
rm $INSTALL_DIR/javy.gz
89-
9087
chmod 755 $INSTALL_DIR/javy
9188
echo $INSTALL_DIR >> $GITHUB_PATH
92-
9389
$INSTALL_DIR/javy -V
9490
9591
- name: Build Javy plugin
@@ -106,6 +102,19 @@ jobs:
106102
cd js
107103
npm ci
108104
105+
- name: Verify git tag matches package.json version
106+
shell: bash
107+
run: |
108+
TAG="${GITHUB_REF#refs/tags/}"
109+
PKG_VERSION=$(jq -r '.version' js/package.json)
110+
if [ "$TAG" != "v$PKG_VERSION" ]; then
111+
echo "Version mismatch!"
112+
echo "Tag: $TAG"
113+
echo "package.json: v$PKG_VERSION"
114+
exit 1
115+
fi
116+
echo "Tag matches package.json version."
117+
109118
- name: Build package
110119
run: |
111120
cd js

0 commit comments

Comments
 (0)