Skip to content

Commit

Permalink
chore: update release script to only commit version changes and nothi…
Browse files Browse the repository at this point in the history
…ng else
  • Loading branch information
admon84 committed Jun 23, 2024
1 parent 5a20c86 commit 05e3367
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Get the current version from package.json
currentVersion=$(node -p "require('./package.json').version")

# Run semantic-release
npx semantic-release

# Get the new version from package.json
newVersion=$(node -p "require('./package.json').version")

# Revert package.json to its state in the Git repository
git checkout HEAD -- package.json

# If the version has changed, update the version in package.json
if [[ "$currentVersion" != "$newVersion" ]]; then
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
npm version --no-git-tag-version $newVersion
git add package.json
git commit -m "chore: release $newVersion [skip ci]"
git push
fi

0 comments on commit 05e3367

Please sign in to comment.