From 05e3367270a3b435038f07d40ee2c9fc92021232 Mon Sep 17 00:00:00 2001 From: admon84 Date: Sun, 23 Jun 2024 13:38:29 -0600 Subject: [PATCH] chore: update release script to only commit version changes and nothing else --- scripts/release.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 scripts/release.sh diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100644 index 0000000..17db241 --- /dev/null +++ b/scripts/release.sh @@ -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