mirror of
https://github.com/dependabot/fetch-metadata.git
synced 2026-03-13 18:17:13 -04:00
31 lines
722 B
Bash
Executable File
31 lines
722 B
Bash
Executable File
#!/bin/bash
|
|
|
|
usage() { echo "Usage: $0 -p [major | minor | patch]" 1>&2; exit 1; }
|
|
|
|
while getopts "p:" o; do
|
|
case "${o}" in
|
|
p)
|
|
patch_level=${OPTARG}
|
|
(( patch_level == 'major' || patch_level == 'minor' || patch_level == 'patch'))
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
|
|
echo "$patch_level"
|
|
|
|
if [[ -z "${patch_level}" ]]; then
|
|
usage
|
|
fi
|
|
|
|
new_version=$(npm version "${patch_level}" --no-git-tag-version)
|
|
git checkout -b "${new_version}"-release-notes
|
|
sed -i.bak "s|dependabot/fetch-metadata@v[0-9.]*|dependabot/fetch-metadata@${new_version}|g" "README.md"
|
|
rm README.md.bak
|
|
git add package.json package-lock.json README.md
|
|
git commit -m "${new_version}"
|
|
|
|
echo "Branch prepared for ${new_version}"
|