Skip to content

Commit bb394bd

Browse files
authored
Merge pull request #14 from rahu619/copilot/fix-release-action-script
fix: remove broken version validation from release workflow
2 parents 88abe37 + 56ce3f6 commit bb394bd

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,24 @@ jobs:
3030
- name: Build
3131
run: npm run build
3232

33-
- name: Get npm Package Version
34-
id: package-version
35-
uses: martinbeentjes/npm-get-version-action@v1.3.1
36-
37-
- name: Validate Version
33+
- name: Validate tag matches package.json version
3834
run: |
39-
if [[ ! ${{ steps.package-version.outputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
40-
echo "Invalid version format: ${{ steps.package-version.outputs.version }}"
35+
PKG_VERSION=$(npm pkg get version | tr -d '"')
36+
if [ -z "$PKG_VERSION" ]; then
37+
echo "Error: package.json version is empty."
38+
exit 1
39+
fi
40+
41+
TAG_VERSION="${GITHUB_REF_NAME#v}"
42+
if [ -z "$TAG_VERSION" ]; then
43+
echo "Error: Git tag (GITHUB_REF_NAME) is empty."
4144
exit 1
4245
fi
4346
47+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
48+
echo "Error: Version mismatch between package.json ($PKG_VERSION) and tag ($TAG_VERSION)."
49+
exit 1
50+
fi
4451
- name: Publish to npmjs
4552
run: npm publish --access public
4653
env:

0 commit comments

Comments
 (0)