Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): correctly tag when bumping the version of the package #47

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
29 changes: 29 additions & 0 deletions bin/version.bash
Original file line number Diff line number Diff line change
@@ -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 <package> <version>"
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"