Skip to content

Commit

Permalink
Merge pull request #379 from cisagov/improvement/change_version_file_…
Browse files Browse the repository at this point in the history
…format

Change the format of the version tracking file
  • Loading branch information
jsf9k authored Dec 10, 2024
2 parents a54a55d + a368704 commit eb4508a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bump-version
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -o errexit
set -o pipefail

# Stores the canonical version for the project.
VERSION_FILE=src/version.txt
VERSION_FILE=version.txt
# Files that should be updated with the new version.
VERSION_FILES=("$VERSION_FILE")

Expand All @@ -29,7 +29,7 @@ Options:
END_OF_LINE
)

old_version=$(sed -n "s/^__version__ = \"\(.*\)\"$/\1/p" $VERSION_FILE)
old_version=$(< "$VERSION_FILE")
# Comment out periods so they are interpreted as periods and don't
# just match any character
old_version_regex=${old_version//\./\\\.}
Expand Down
2 changes: 1 addition & 1 deletion setup-env
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ for req_file in "requirements-dev.txt" "requirements-test.txt" "requirements.txt
done

# Install Packer plugin dependencies
packer init -upgrade src
packer init -upgrade .

# Install git pre-commit hooks now or later.
pre-commit install ${INSTALL_HOOKS:+"--install-hooks"}
Expand Down
4 changes: 1 addition & 3 deletions tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
)
def test_release_version():
"""Verify that release tag version agrees with the module version."""
pkg_vars = {}
with open(VERSION_FILE) as f:
exec(f.read(), pkg_vars) # nosec
project_version = pkg_vars["__version__"]
project_version = f.read().strip()
assert (
GITHUB_RELEASE_TAG == f"v{project_version}"
), "GITHUB_RELEASE_TAG does not match the project version"
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.0"
2.0.0

0 comments on commit eb4508a

Please sign in to comment.