Skip to content

Commit b89f197

Browse files
Merge pull request #302 from AikidoSec/AIK-4311
AIK-4311 Automatically replace version number before release
2 parents 07648c2 + d07934e commit b89f197

File tree

6 files changed

+25
-6
lines changed

6 files changed

+25
-6
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
run: |
1818
sudo echo "127.0.0.1 local.aikido.io" | sudo tee -a /etc/hosts
1919
- name: Installation
20-
run: make install
20+
run: make dev_install
2121
- name: Run Pylint
2222
run: |
2323
poetry run pylint --fail-under=9 --rcfile=.pylintrc aikido_zen/
@@ -48,6 +48,10 @@ jobs:
4848
- uses: actions/checkout@v4
4949
- name: Install poetry
5050
run: pip install poetry
51+
- name: Set the version for this release
52+
run: |
53+
TAG_NAME=${GITHUB_REF##*/}
54+
make replace_version version=${TAG_NAME#v}
5155
- name: Download binaries & build
5256
run: make build
5357
- name: Publish to PyPI

.github/workflows/test-publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
run: |
1919
sudo echo "127.0.0.1 local.aikido.io" | sudo tee -a /etc/hosts
2020
- name: Installation
21-
run: make install
21+
run: make dev_install
2222
- name: Run Pylint
2323
run: |
2424
poetry run pylint --fail-under=9 --rcfile=.pylintrc aikido_zen/
@@ -49,6 +49,10 @@ jobs:
4949
- uses: actions/checkout@v4
5050
- name: Install poetry
5151
run: pip install poetry
52+
- name: Set the version for this release
53+
run: |
54+
TAG_NAME=${GITHUB_REF##*/}
55+
make replace_version version=${TAG_NAME#dev-v}
5256
- name: Install dependencies
5357
run: poetry install
5458
- name: Download binaries & build

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,16 @@ check_binaries:
7171
echo "Directory $(CACHE_DIR) is empty. Running 'make binaries'..."; \
7272
$(MAKE) binaries; \
7373
fi
74+
75+
76+
# Replace version number automatically on publish :
77+
VERSION_FILES = ./build.gradle ./agent_api/src/main/java/dev/aikido/agent_api/Config.java
78+
replace_version:
79+
@if [ -z "$(version)" ]; then \
80+
echo "Error: No version specified. Use 'make replace_version version=<new_version>'."; \
81+
exit 1; \
82+
fi;
83+
84+
poetry version $(version)
85+
sed -i.bak "s/1.0-REPLACE-VERSION/$$version/g" aikido_zen/config.py
86+
rm aikido_zen/config.py.bak

aikido_zen/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Contains package versions"""
22

3-
PKG_VERSION = "1.1.1"
3+
PKG_VERSION = "1.0-REPLACE-VERSION"

aikido_zen/context/users_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from lib2to3.fixes.fix_input import context
2-
31
import pytest
42

53
from . import current_context, Context

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "aikido_zen"
3-
version = "1.1.1"
3+
version = "1.0.0"
44
description = "Aikido Zen for Python"
55
authors = ["Aikido Security <[email protected]>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)