Skip to content

Instantly share code, notes, and snippets.

@fooman
Created June 8, 2019 21:40
Show Gist options
  • Save fooman/a88df69b1b259d3efd95a98248493969 to your computer and use it in GitHub Desktop.
Save fooman/a88df69b1b259d3efd95a98248493969 to your computer and use it in GitHub Desktop.
Keep composer version in sync with git tag
#!/bin/bash
# tested on MacOS - uses gsed
# brew install gnu-sed
TAG="$1"
if [[ -z "$TAG" ]]; then
echo "Usage: tag-release.sh TAG"
echo " Example: tag-release.sh 1.0.0"
exit 1
fi
gsed -i 's#"version":[[:space:]]"[^0-9.]*\([0-9.]*\).*"#"version": "'${TAG}'"#' composer.json
git add composer.json
git commit -m "Bumped version to ${TAG}"
git tag ${TAG}
git push
git push --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment