diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8e9d363..688f8f4 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,7 +22,7 @@ jobs: contents: write pull-requests: read outputs: - version: ${{ steps.release.outputs.tag_name }} + version: ${{ steps.release.outputs.version }} steps: # https://github.com/actions/checkout/tree/11bd71901bbe5b1630ceea73d27597364c9af683 diff --git a/api/src/config.py b/api/src/config.py index 2f29b8e..5b93aff 100644 --- a/api/src/config.py +++ b/api/src/config.py @@ -32,8 +32,8 @@ class Settings(BaseSettings): def check_image_version(cls, v): if v == "": return None - if v and not v.startswith("v"): - return f"v{v}" + if v.startswith("v"): + return v[1:] return v @model_validator(mode="before") diff --git a/api/tests/test_config.py b/api/tests/test_config.py index 9ad0944..6ce314c 100644 --- a/api/tests/test_config.py +++ b/api/tests/test_config.py @@ -29,7 +29,7 @@ def test_settings_with_custom_settings(): APP_NAME="api", APP_PACKAGE="api2", APP_ENV="production", - IMAGE_VERSION="v1.0.0", + IMAGE_VERSION="1.0.0", MARIADB_SERVER="127.0.0.1", MARIADB_PORT=3307, MARIADB_USER="user2", @@ -40,7 +40,7 @@ def test_settings_with_custom_settings(): assert custom.APP_NAME == "api" assert custom.APP_PACKAGE == "api2" assert custom.APP_ENV == "production" - assert custom.IMAGE_VERSION == "v1.0.0" + assert custom.IMAGE_VERSION == "1.0.0" assert custom.MARIADB_SERVER == "127.0.0.1" assert custom.MARIADB_PORT == 3307 assert custom.MARIADB_USER == "user2" @@ -53,11 +53,11 @@ def test_settings_with_custom_settings(): ) -def test_image_version_without_v_prefix(): +def test_image_version_wit_v_prefix(): custom = Settings( - IMAGE_VERSION="1.0.0", + IMAGE_VERSION="v1.0.0", ) - assert custom.IMAGE_VERSION == "v1.0.0" + assert custom.IMAGE_VERSION == "1.0.0" def test_settings_missing_password():