Skip to content

Commit bde97e0

Browse files
committed
Pull in updates to the bump_version.sh script
Pull in updates from cisagov/skeleton-packer around the regex used to find the old version.
1 parent 78b1cd2 commit bde97e0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bump_version.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ VERSION_FILE=src/version.txt
1111
HELP_INFORMATION="bump_version.sh (show|major|minor|patch|prerelease|build|finalize)"
1212

1313
old_version=$(sed -n "s/^__version__ = \"\(.*\)\"$/\1/p" $VERSION_FILE)
14+
# Comment out periods so they are interpreted as periods and don't
15+
# just match any character
16+
old_version_regex=${old_version//\./\\\.}
1417

1518
if [ $# -ne 1 ]; then
1619
echo "$HELP_INFORMATION"
@@ -22,7 +25,7 @@ else
2225
# A temp file is used to provide compatability with macOS development
2326
# as a result of macOS using the BSD version of sed
2427
tmp_file=/tmp/version.$$
25-
sed "s/$old_version/$new_version/" $VERSION_FILE > $tmp_file
28+
sed "s/$old_version_regex/$new_version/" $VERSION_FILE > $tmp_file
2629
mv $tmp_file $VERSION_FILE
2730
git add $VERSION_FILE
2831
git commit -m"Bump version from $old_version to $new_version"
@@ -34,10 +37,10 @@ else
3437
# A temp file is used to provide compatability with macOS development
3538
# as a result of macOS using the BSD version of sed
3639
tmp_file=/tmp/version.$$
37-
sed "s/$old_version/$new_version/" $VERSION_FILE > $tmp_file
40+
sed "s/$old_version_regex/$new_version/" $VERSION_FILE > $tmp_file
3841
mv $tmp_file $VERSION_FILE
3942
git add $VERSION_FILE
40-
git commit -m"Bump version from $old_version to $new_version"
43+
git commit -m"Finalize version from $old_version to $new_version"
4144
git push
4245
;;
4346
show)

0 commit comments

Comments
 (0)