Skip to content

Commit

Permalink
Use semantic versioning (#30)
Browse files Browse the repository at this point in the history
* git: use semver

* gh: bump minor version
  • Loading branch information
csegarragonz committed Jul 20, 2023
1 parent d7d3362 commit cfe5cc9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: faasm.azurecr.io/cpython:0.2.6
image: faasm.azurecr.io/cpython:0.3.0
credentials:
username: ${{ secrets.ACR_SERVICE_PRINCIPAL_ID }}
password: ${{ secrets.ACR_SERVICE_PRINCIPAL_PASSWORD }}
Expand All @@ -44,7 +44,7 @@ jobs:
REDIS_QUEUE_HOST: redis
REDIS_STATE_HOST: redis
container:
image: faasm.azurecr.io/cpython:0.2.6
image: faasm.azurecr.io/cpython:0.3.0
credentials:
username: ${{ secrets.ACR_SERVICE_PRINCIPAL_ID }}
password: ${{ secrets.ACR_SERVICE_PRINCIPAL_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.6
0.3.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black==22.3.0
faasmctl==0.5.6
faasmctl==0.7.1
flake8==3.9.2
invoke>=2.0.0
numpy==1.22.0
Expand Down
32 changes: 22 additions & 10 deletions tasks/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,32 @@ def get_tag_name(version):


@task
def bump(ctx, ver=None):
def bump(ctx, patch=False, minor=False, major=False):
"""
Bump code version
Bump the code version by --patch, --minor, or --major
"""
old_ver = get_version()

if ver:
new_ver = ver
new_ver_parts = old_ver.split(".")

if patch:
idx = 2
elif minor:
idx = 1
elif major:
idx = 0
else:
# Just bump the last minor version part
new_ver_parts = old_ver.split(".")
new_ver_minor = int(new_ver_parts[-1]) + 1
new_ver_parts[-1] = str(new_ver_minor)
new_ver = ".".join(new_ver_parts)
raise RuntimeError("Must set one in: --[patch,minor,major]")

# Change the corresponding idx
new_ver_parts[idx] = str(int(new_ver_parts[idx]) + 1)

# Zero-out the following version numbers (i.e. lower priority). This is
# because if we tag a new major release, we want to zero-out the minor
# and patch versions (e.g. 0.2.0 comes after 0.1.9)
for next_idx in range(idx + 1, 3):
new_ver_parts[next_idx] = "0"

new_ver = ".".join(new_ver_parts)

# Replace version in all files
for f in VERSIONED_FILES:
Expand Down

0 comments on commit cfe5cc9

Please sign in to comment.