Skip to content

Commit e971fc3

Browse files
authored
Use semantic versioning (#120)
* git: adopt semantic versioning * gh: bump minor version
1 parent 16102b1 commit e971fc3

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
SYSROOT_VERSION=0.2.9
2-
SYSROOT_CLI_IMAGE=faasm.azurecr.io/cpp-sysroot:0.2.9
1+
SYSROOT_VERSION=0.3.0
2+
SYSROOT_CLI_IMAGE=faasm.azurecr.io/cpp-sysroot:0.3.0
33
COMPOSE_PROJECT_NAME=cpp-dev

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
if: github.event.pull_request.draft == false
2020
runs-on: ubuntu-latest
2121
container:
22-
image: faasm.azurecr.io/cpp-sysroot:0.2.9
22+
image: faasm.azurecr.io/cpp-sysroot:0.3.0
2323
credentials:
2424
username: ${{ secrets.ACR_SERVICE_PRINCIPAL_ID }}
2525
password: ${{ secrets.ACR_SERVICE_PRINCIPAL_PASSWORD }}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.9
1+
0.3.0

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
black==22.3.0
2-
faasmctl==0.5.6
2+
faasmctl==0.7.1
33
flake8==4.0.1
44
invoke>=2.0.0
55
requests>=2.31.0

tasks/git.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,32 @@ def get_tag_name(version):
1515

1616

1717
@task
18-
def bump(ctx, ver=None):
18+
def bump(ctx, patch=False, minor=False, major=False):
1919
"""
20-
Bump code version
20+
Bump the code version by --patch, --minor, or --major
2121
"""
2222
old_ver = get_version()
23-
24-
if ver:
25-
new_ver = ver
23+
new_ver_parts = old_ver.split(".")
24+
25+
if patch:
26+
idx = 2
27+
elif minor:
28+
idx = 1
29+
elif major:
30+
idx = 0
2631
else:
27-
# Just bump the last minor version part
28-
new_ver_parts = old_ver.split(".")
29-
new_ver_minor = int(new_ver_parts[-1]) + 1
30-
new_ver_parts[-1] = str(new_ver_minor)
31-
new_ver = ".".join(new_ver_parts)
32+
raise RuntimeError("Must set one in: --[patch,minor,major]")
33+
34+
# Change the corresponding idx
35+
new_ver_parts[idx] = str(int(new_ver_parts[idx]) + 1)
36+
37+
# Zero-out the following version numbers (i.e. lower priority). This is
38+
# because if we tag a new major release, we want to zero-out the minor
39+
# and patch versions (e.g. 0.2.0 comes after 0.1.9)
40+
for next_idx in range(idx + 1, 3):
41+
new_ver_parts[next_idx] = "0"
42+
43+
new_ver = ".".join(new_ver_parts)
3244

3345
# Replace version in all files
3446
for f in VERSIONED_FILES:

0 commit comments

Comments
 (0)