diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9269c22..2a55876 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: - build - test + - version - deploy build: @@ -40,6 +41,30 @@ test_variable: rules: - if: '$CI_COMMIT_TAG' +extract_version: + stage: version + image: alpine:latest + script: + - apk add --no-cache jq + - VERSION=$(grep 'version = "' Cargo.toml | awk -F'"' '{print $2}' | head -n 1) + - if [ $? -ne 0 ]; then echo "Error extracting version"; exit 1; fi + - echo "Extracted version is" + - echo "$VERSION" + - echo "VERSION=$VERSION" > version.env + artifacts: + reports: + dotenv: version.env + +tag_release: + stage: deploy + image: registry.gitlab.com/gitlab-org/release-cli:latest + rules: + - if: '$CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"' + dependencies: + - extract_version + script: + - release-cli create --name "Release v$VERSION" --tag-name "v$VERSION" + deploy: stage: deploy image: rust:1.85 @@ -53,3 +78,4 @@ deploy: - build rules: - if: '$CI_COMMIT_TAG' + diff --git a/Cargo.toml b/Cargo.toml index b061e8f..cf7fc91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "icarus-models" -description = "models used for the icarus project" -license = "MIT" version = "0.1.7" edition = "2024" +description = "models used for the icarus project" +license = "MIT" [dependencies] serde = { version = "1.0.218", features = ["derive"] }