diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8714d16..0a49e83 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,6 @@ jobs: run: git checkout main && git pull --tags - name: Bump Version run: | - npm version ${{ github.event.inputs.type }} --no-commit-hooks --message "chore(release): %s" -w packages/addons + ./bin/version.bash addons ${{ github.event.inputs.type }} - name: Push Version run: git push && git push --tags diff --git a/bin/version.bash b/bin/version.bash new file mode 100644 index 0000000..4df016c --- /dev/null +++ b/bin/version.bash @@ -0,0 +1,29 @@ +#! /usr/bin/env bash +set -euo pipefail + +# inspired by https://github.com/textbook/fauxauth/blob/v8.1.5/bin/version.sh + +if [ $# -ne 2 ]; then + echo "usage: ./bin/version.bash " + echo "This will update the version for the give package" + exit 1 +fi + +if [ -n "$(git status --porcelain)" ]; then + echo 'Git working directory not clean.' + exit 1 +fi + +packageName=$1 +npmVersion=$2 + +echo "Bumping package ${packageName} to ${npmVersion}" +npm version ${npmVersion} --no-git-tag-version -w packages/${packageName} + +VERSION=`node -p "require('./packages/${packageName}/package.json').version"` +echo "New package version: ${VERSION}" + +echo "Committing and tagging..." +git commit -a --message "chore(release): ${VERSION}" +git tag "v${VERSION}" +echo "Commit and tag done"