From b2106080d93811853f97c14f903b0e6b218638af Mon Sep 17 00:00:00 2001 From: Caroline Russell Date: Fri, 23 Feb 2024 18:14:56 -0500 Subject: [PATCH] Fix: Correct checking that versions in package and pyproject.toml are synced. (#24) Signed-off-by: Caroline Russell --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 12 ++++++++++-- atom_tools/__init__.py | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 237410c..bc76a53 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: - name: Make sure version in atom_tools.__init__.py has been updated run: | version=$(python3 -c 'from atom_tools.__init__ import __version__; print(f"refs/tags/v{__version__}")') - if $version != ${{ github.ref }}; then + if $version != "${{ github.ref }}"; then echo "Version in atom_tools.__init__.py has not been updated. $version != ${{ github.ref }}" exit 1 fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8794df6..258c9e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,8 +28,16 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.11" - - name: Display Python version - run: python -c "import sys; print(sys.version)" + - name: Make sure versions are synced if PR or ref is tag + if: ${{ github.event_name == 'pull_request' || github.ref_type == 'tag' }} + shell: bash + run: | + init_version=$(head -n 4 atom_tools/__init__.py | tail -1 | cut -d"'" -f2) + toml_version=$(head -n 3 pyproject.toml | tail -1 | cut -d'"' -f2) + if [ "$init_version" != "$toml_version" ]; then + echo "Version in atom_tools.__init__.py does not match pyproject.toml." + exit 1 + fi - name: Install dependencies run: | python3 -m pip install --upgrade pip setuptools diff --git a/atom_tools/__init__.py b/atom_tools/__init__.py index 1c31cbd..fb7046b 100644 --- a/atom_tools/__init__.py +++ b/atom_tools/__init__.py @@ -1,4 +1,4 @@ """ A cli, classes and functions for converting an atom slice to a different format """ -__version__ = '0.1.2' +__version__ = '0.2.1'