Skip to content

Commit

Permalink
Add GHA to check version has changed
Browse files Browse the repository at this point in the history
  • Loading branch information
orlade committed Dec 19, 2024
1 parent b588cc8 commit ecec8b1
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/check-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Check that the version has changed in setup.py.
# Changing the code but not the version breaks `pip install` for projects that depend on this
# package via marqo_commons @ git+https://github.com/marqo-ai/marqo-commons.git@main#egg=marqo_commons
name: Check Version

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- "requirements.txt"
- "setup.py"
- "src/**"

jobs:
test:
name: Run Pytest
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8

- name: Check that version has changed
run: |
# Get the version from setup.py at the base branch
BASE_BRANCH=main
BASE_VERSION=$(git show ${BASE_BRANCH}:setup.py | grep version | head -n1 | cut -d'"' -f2)
# Get the version from setup.py at the current branch
CURRENT_VERSION=$(grep version setup.py | head -n1 | cut -d'"' -f2)
# Check if the versions are the same
if [ "$BASE_VERSION" == "$CURRENT_VERSION" ]; then
echo "Version has not changed"
exit 1
fi

0 comments on commit ecec8b1

Please sign in to comment.