Skip to content

Commit

Permalink
Merge pull request #302 from AikidoSec/AIK-4311
Browse files Browse the repository at this point in the history
AIK-4311 Automatically replace version number before release
  • Loading branch information
willem-delbare authored Jan 23, 2025
2 parents 07648c2 + d07934e commit b89f197
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
sudo echo "127.0.0.1 local.aikido.io" | sudo tee -a /etc/hosts
- name: Installation
run: make install
run: make dev_install
- name: Run Pylint
run: |
poetry run pylint --fail-under=9 --rcfile=.pylintrc aikido_zen/
Expand Down Expand Up @@ -48,6 +48,10 @@ jobs:
- uses: actions/checkout@v4
- name: Install poetry
run: pip install poetry
- name: Set the version for this release
run: |
TAG_NAME=${GITHUB_REF##*/}
make replace_version version=${TAG_NAME#v}
- name: Download binaries & build
run: make build
- name: Publish to PyPI
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: |
sudo echo "127.0.0.1 local.aikido.io" | sudo tee -a /etc/hosts
- name: Installation
run: make install
run: make dev_install
- name: Run Pylint
run: |
poetry run pylint --fail-under=9 --rcfile=.pylintrc aikido_zen/
Expand Down Expand Up @@ -49,6 +49,10 @@ jobs:
- uses: actions/checkout@v4
- name: Install poetry
run: pip install poetry
- name: Set the version for this release
run: |
TAG_NAME=${GITHUB_REF##*/}
make replace_version version=${TAG_NAME#dev-v}
- name: Install dependencies
run: poetry install
- name: Download binaries & build
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,16 @@ check_binaries:
echo "Directory $(CACHE_DIR) is empty. Running 'make binaries'..."; \
$(MAKE) binaries; \
fi


# Replace version number automatically on publish :
VERSION_FILES = ./build.gradle ./agent_api/src/main/java/dev/aikido/agent_api/Config.java
replace_version:
@if [ -z "$(version)" ]; then \
echo "Error: No version specified. Use 'make replace_version version=<new_version>'."; \
exit 1; \
fi;

poetry version $(version)
sed -i.bak "s/1.0-REPLACE-VERSION/$$version/g" aikido_zen/config.py
rm aikido_zen/config.py.bak
2 changes: 1 addition & 1 deletion aikido_zen/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Contains package versions"""

PKG_VERSION = "1.1.1"
PKG_VERSION = "1.0-REPLACE-VERSION"
2 changes: 0 additions & 2 deletions aikido_zen/context/users_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from lib2to3.fixes.fix_input import context

import pytest

from . import current_context, Context
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aikido_zen"
version = "1.1.1"
version = "1.0.0"
description = "Aikido Zen for Python"
authors = ["Aikido Security <help@aikido.dev>"]
readme = "README.md"
Expand Down

0 comments on commit b89f197

Please sign in to comment.