From a5c878a52e32c41d3b33dd82f2d6dbb367051377 Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Fri, 8 Nov 2024 14:18:20 +0000 Subject: [PATCH 01/24] read version from git tag and replace inside of pyproject.toml --- .github/workflows/cd.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 11bd2518..bdf7a51b 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -26,10 +26,16 @@ jobs: TAG_NO_PREFIX=$(echo "$TAG" | sed 's/^refs\/tags\///') # Extract the path of the module to publish from the tag PACKAGE_PATH=$(echo "$TAG_NO_PREFIX" | rev | cut -d'/' -f2- | rev) - # Save the path to the module for use in the build/publish step to only update the module associated with this tag + # Extract version to publish from tag + VERSION="${TAG_NO_PREFIX##*/}" + echo $VERSION + # Save the path to the module and the version for use in the build/publish step to only update the module associated with this tag echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Build & Publish to PyPi run: | pip install poetry - cd $PACKAGE_PATH + cd $PACKAGE_PATH + # replace version + sed -i "s/^version =.*/version = \"${VERSION}\"/" pyproject.toml poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}" \ No newline at end of file From 3ccbba25d5a8d19b6c506cf02920b700e3583023 Mon Sep 17 00:00:00 2001 From: Melvin <70433111+MelvinKl@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:42:13 +0100 Subject: [PATCH 02/24] Update cd.yaml --- .github/workflows/cd.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index bdf7a51b..598d036b 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -28,7 +28,6 @@ jobs: PACKAGE_PATH=$(echo "$TAG_NO_PREFIX" | rev | cut -d'/' -f2- | rev) # Extract version to publish from tag VERSION="${TAG_NO_PREFIX##*/}" - echo $VERSION # Save the path to the module and the version for use in the build/publish step to only update the module associated with this tag echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV echo "VERSION=$VERSION" >> $GITHUB_ENV @@ -38,4 +37,4 @@ jobs: cd $PACKAGE_PATH # replace version sed -i "s/^version =.*/version = \"${VERSION}\"/" pyproject.toml - poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}" \ No newline at end of file + poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}" From 26bc606b74759ea05cd84c9e58b032c2232bd7c2 Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Mon, 11 Nov 2024 13:29:26 +0000 Subject: [PATCH 03/24] add trigger for release --- .github/workflows/release-trigger.yaml | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/release-trigger.yaml diff --git a/.github/workflows/release-trigger.yaml b/.github/workflows/release-trigger.yaml new file mode 100644 index 00000000..e7e3308c --- /dev/null +++ b/.github/workflows/release-trigger.yaml @@ -0,0 +1,47 @@ +name: Check Version Update + +on: + push: + branches: + - main + +jobs: + check-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Find pyproject.toml files + run: | + pyproject_toml_files=$(git diff --name-only HEAD~1..HEAD | grep pyproject.toml) + if [ -z "$pyproject_toml_files" ]; then + echo "No pyproject.toml files changed" + exit 0 + fi + echo "$pyproject_toml_files" + - name: Check version update + run: | + git config --global user.name "GitHub Action" + git config --global user.email "github-action@github.com" + for file in ${{ steps.find-pyproject-toml-files.outputs.pyproject_toml_files }}; do + git diff --quiet HEAD~1..HEAD $file || true + if git diff --quiet HEAD~1..HEAD $file; then + echo "No changes in $file" + else + version_line=$(git diff HEAD~1..HEAD $file | grep "^+.*version = ") + if [ -n "$version_line" ]; then + echo "Version updated in $file" + # Run your action here + version=$(grep -o "version = .*" file.txt | cut -d '=' -f 2-) + # Get the update package + dirpath=$(dirname "$filepath") + relpath=${filepath#*/core|stackit/*} + tag = ${relpath}/${version} + echo $tag + git tag -a $version -m "Release $version" + echo git status + # git push origin --tags + else + echo "No version update in $file" + fi + fi + done \ No newline at end of file From a649af537ffaea5ed19a694caa771a51aaefd0fd Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Mon, 11 Nov 2024 13:38:43 +0000 Subject: [PATCH 04/24] change core version for testing purposes --- core/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pyproject.toml b/core/pyproject.toml index ba89996d..5d6f7ede 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-core" -version = "0.0.1a1" +version = "0.0.1a2" authors = [ "STACKIT Developer Tools ", ] From a7cd2ff0cea8ec7dc9f25a5de1f5a373eb55a2e5 Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Mon, 11 Nov 2024 15:33:12 +0000 Subject: [PATCH 05/24] another package another try --- services/dns/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index 8a0cd6c6..1733fd86 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -18,7 +18,7 @@ packages = [ [tool.poetry.dependencies] python = ">=3.8,<4.0" -stackit-core = "^0.0.1a" +stackit-core = "^0.0.1a2" requests = "^2.32.3" pydantic = "^2.9.2" python-dateutil = "^2.9.0.post0" From 3bb79d15cd41720d703e7423d1ac08bc537e673f Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Mon, 11 Nov 2024 17:08:17 +0100 Subject: [PATCH 06/24] actuall change the correct property --- services/dns/pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index 1733fd86..751086a6 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-dns" -version = "0.0.1a" +version = "0.0.1a2" authors = [ "stackit-dns ", ] @@ -102,4 +102,4 @@ per-file-ignores = """ # E501: long descriptions/string values might lead to lines that are too long # B028: stacklevel for deprecation warning is irrelevant ./src/stackit/*/api/default_api.py: F841,B028,E501 -""" \ No newline at end of file +""" From 72866de9efd2cf02248dce6d069f1aa0f1b9f818 Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Mon, 11 Nov 2024 17:29:26 +0100 Subject: [PATCH 07/24] adds workflow for creating tag --- .github/workflows/release-trigger.yaml | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release-trigger.yaml b/.github/workflows/release-trigger.yaml index e7e3308c..49b7f683 100644 --- a/.github/workflows/release-trigger.yaml +++ b/.github/workflows/release-trigger.yaml @@ -17,31 +17,31 @@ jobs: echo "No pyproject.toml files changed" exit 0 fi - echo "$pyproject_toml_files" + echo "pyproject_toml_files=$pyproject_toml_files" >> $GITHUB_ENV - name: Check version update run: | git config --global user.name "GitHub Action" git config --global user.email "github-action@github.com" - for file in ${{ steps.find-pyproject-toml-files.outputs.pyproject_toml_files }}; do - git diff --quiet HEAD~1..HEAD $file || true - if git diff --quiet HEAD~1..HEAD $file; then - echo "No changes in $file" + + for file in ${pyproject_toml_files}; do + if git diff HEAD~1..HEAD $file | grep "version ="; then + dirpath=$(dirname $file) + echo "pyproject.toml updated in $dirpath" + # Run your action here + version=$(grep -o "version = .*" ${file} | cut -d '=' -f 2-) + dirpath=$(dirname $file) + relpath=${file#*/core|stackit/*} + cleaned_version=$(echo "$version" | tr -d '" ') + tag=$(echo "${dirpath}/${cleaned_version}") + echo $file + echo $dirpath + echo $cleaned_version + echo $tag + + #git tag -a $tag -m "Release $version" + echo $(git status) + # git push origin --tags else - version_line=$(git diff HEAD~1..HEAD $file | grep "^+.*version = ") - if [ -n "$version_line" ]; then - echo "Version updated in $file" - # Run your action here - version=$(grep -o "version = .*" file.txt | cut -d '=' -f 2-) - # Get the update package - dirpath=$(dirname "$filepath") - relpath=${filepath#*/core|stackit/*} - tag = ${relpath}/${version} - echo $tag - git tag -a $version -m "Release $version" - echo git status - # git push origin --tags - else - echo "No version update in $file" - fi - fi + echo "No change in version found." + fi done \ No newline at end of file From 4d4373611e00e32442645458b8c9f60eebad4387 Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Mon, 11 Nov 2024 17:58:23 +0100 Subject: [PATCH 08/24] another change --- services/dns/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index 751086a6..5bf4d53e 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-dns" -version = "0.0.1a2" +version = "0.0.1a3" authors = [ "stackit-dns ", ] From 3d5971d78c3a73be28c3c8ff2fb31b3777ac0f1e Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 11 Nov 2024 17:59:52 +0100 Subject: [PATCH 09/24] a --- services/dns/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index 5bf4d53e..8e61b2a9 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -17,7 +17,7 @@ packages = [ ] [tool.poetry.dependencies] -python = ">=3.8,<4.0" +python = ">=3.8,<4.2" stackit-core = "^0.0.1a2" requests = "^2.32.3" pydantic = "^2.9.2" From 1308d4c57f12fdc4176d92d605d3dc59c5a380a6 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 11 Nov 2024 18:02:09 +0100 Subject: [PATCH 10/24] simplified --- .github/workflows/release-trigger.yaml | 44 ++++++++------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release-trigger.yaml b/.github/workflows/release-trigger.yaml index 49b7f683..f180408d 100644 --- a/.github/workflows/release-trigger.yaml +++ b/.github/workflows/release-trigger.yaml @@ -10,38 +10,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Find pyproject.toml files - run: | - pyproject_toml_files=$(git diff --name-only HEAD~1..HEAD | grep pyproject.toml) - if [ -z "$pyproject_toml_files" ]; then - echo "No pyproject.toml files changed" - exit 0 - fi - echo "pyproject_toml_files=$pyproject_toml_files" >> $GITHUB_ENV - - name: Check version update + - name: Push tag for each updated package run: | git config --global user.name "GitHub Action" git config --global user.email "github-action@github.com" - for file in ${pyproject_toml_files}; do - if git diff HEAD~1..HEAD $file | grep "version ="; then - dirpath=$(dirname $file) - echo "pyproject.toml updated in $dirpath" - # Run your action here - version=$(grep -o "version = .*" ${file} | cut -d '=' -f 2-) - dirpath=$(dirname $file) - relpath=${file#*/core|stackit/*} - cleaned_version=$(echo "$version" | tr -d '" ') - tag=$(echo "${dirpath}/${cleaned_version}") - echo $file - echo $dirpath - echo $cleaned_version - echo $tag - - #git tag -a $tag -m "Release $version" - echo $(git status) - # git push origin --tags - else - echo "No change in version found." - fi + for file in $(git diff --name-only HEAD~1..HEAD | grep pyproject.toml); do + if git diff HEAD~1..HEAD $file | grep "version ="; then + dirpath=$(dirname $file) + version=$(grep -o "version = .*" ${file} | cut -d '=' -f 2-) + dirpath=$(dirname $file) + relpath=${file#*/core|stackit/*} + cleaned_version=$(echo "$version" | tr -d '" ') + tag=$(echo "${dirpath}/${cleaned_version}") + git tag -a $tag -m "Release $version" + git push origin --tags + else + echo "No change in version found." + fi done \ No newline at end of file From 928efdc63be1a61c2fa4b52e84de140fc9f6c6c6 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 11 Nov 2024 18:03:07 +0100 Subject: [PATCH 11/24] simplify --- .github/workflows/cd.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 598d036b..cd287cc7 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -30,11 +30,8 @@ jobs: VERSION="${TAG_NO_PREFIX##*/}" # Save the path to the module and the version for use in the build/publish step to only update the module associated with this tag echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV - echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Build & Publish to PyPi run: | pip install poetry cd $PACKAGE_PATH - # replace version - sed -i "s/^version =.*/version = \"${VERSION}\"/" pyproject.toml poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}" From c7a4aadc65ef051864192a73632be70ccad12eae Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 11 Nov 2024 18:05:07 +0100 Subject: [PATCH 12/24] remove test changes --- core/pyproject.toml | 2 +- services/dns/pyproject.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/pyproject.toml b/core/pyproject.toml index 5d6f7ede..ba89996d 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-core" -version = "0.0.1a2" +version = "0.0.1a1" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index 8e61b2a9..d45211b4 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-dns" -version = "0.0.1a3" +version = "0.0.1a" authors = [ "stackit-dns ", ] @@ -17,8 +17,8 @@ packages = [ ] [tool.poetry.dependencies] -python = ">=3.8,<4.2" -stackit-core = "^0.0.1a2" +python = ">=3.8,<4.0" +stackit-core = "^0.0.1a" requests = "^2.32.3" pydantic = "^2.9.2" python-dateutil = "^2.9.0.post0" From eb2beb01fbcb20e09f8d7754b03fefae0aa2feb6 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 11 Nov 2024 18:05:57 +0100 Subject: [PATCH 13/24] simplify --- .github/workflows/cd.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index cd287cc7..78df0739 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -26,8 +26,6 @@ jobs: TAG_NO_PREFIX=$(echo "$TAG" | sed 's/^refs\/tags\///') # Extract the path of the module to publish from the tag PACKAGE_PATH=$(echo "$TAG_NO_PREFIX" | rev | cut -d'/' -f2- | rev) - # Extract version to publish from tag - VERSION="${TAG_NO_PREFIX##*/}" # Save the path to the module and the version for use in the build/publish step to only update the module associated with this tag echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV - name: Build & Publish to PyPi From 1c4092753edae2dc55b357b9818c26aacdf0de9f Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 11 Nov 2024 18:06:26 +0100 Subject: [PATCH 14/24] simplify --- .github/workflows/cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 78df0739..1645a7cc 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -26,7 +26,7 @@ jobs: TAG_NO_PREFIX=$(echo "$TAG" | sed 's/^refs\/tags\///') # Extract the path of the module to publish from the tag PACKAGE_PATH=$(echo "$TAG_NO_PREFIX" | rev | cut -d'/' -f2- | rev) - # Save the path to the module and the version for use in the build/publish step to only update the module associated with this tag + # Save the path to the module for use in the build/publish step to only update the module associated with this tag echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV - name: Build & Publish to PyPi run: | From 372ae0b7e4ec5c27ff8b42a5398fb64a7b01ac53 Mon Sep 17 00:00:00 2001 From: SDK Releaser Bot Date: Tue, 12 Nov 2024 07:37:16 +0100 Subject: [PATCH 15/24] test --- services/dns/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index d45211b4..f3a53764 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -1,5 +1,6 @@ [tool.poetry] name = "stackit-dns" + version = "0.0.1a" authors = [ "stackit-dns ", From d5b935cf02c7cfb0a85c6860c70ec2e26010748d Mon Sep 17 00:00:00 2001 From: SDK Releaser Bot Date: Tue, 12 Nov 2024 07:41:42 +0100 Subject: [PATCH 16/24] test --- services/dns/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index f3a53764..750060be 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "stackit-dns" -version = "0.0.1a" +version = "0.0.1a2" authors = [ "stackit-dns ", ] From f1e55c2072bd96402c53247362eedb9f960ae5d1 Mon Sep 17 00:00:00 2001 From: SDK Releaser Bot Date: Tue, 12 Nov 2024 08:01:31 +0100 Subject: [PATCH 17/24] test --- core/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pyproject.toml b/core/pyproject.toml index ba89996d..5d6f7ede 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-core" -version = "0.0.1a1" +version = "0.0.1a2" authors = [ "STACKIT Developer Tools ", ] From 3c01737b7c95005203cc7829416c65fa990d1b2b Mon Sep 17 00:00:00 2001 From: SDK Releaser Bot Date: Tue, 12 Nov 2024 08:05:11 +0100 Subject: [PATCH 18/24] test --- services/dns/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index 750060be..a450f261 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -1,6 +1,7 @@ [tool.poetry] name = "stackit-dns" + version = "0.0.1a2" authors = [ "stackit-dns ", From 56b7fef749471c4aaad9aba6425581cdde6724ec Mon Sep 17 00:00:00 2001 From: SDK Releaser Bot Date: Tue, 12 Nov 2024 08:05:40 +0100 Subject: [PATCH 19/24] test --- core/pyproject.toml | 2 +- services/dns/pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/pyproject.toml b/core/pyproject.toml index 5d6f7ede..825e10ae 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-core" -version = "0.0.1a2" +version = "0.0.1a3" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index a450f261..1facefe8 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -2,7 +2,7 @@ name = "stackit-dns" -version = "0.0.1a2" +version = "0.0.1a3" authors = [ "stackit-dns ", ] From 3588afb5b16f0d21925bc0c0c614ec670cf14fe6 Mon Sep 17 00:00:00 2001 From: SDK Releaser Bot Date: Tue, 12 Nov 2024 08:08:46 +0100 Subject: [PATCH 20/24] revise pipeline --- .github/workflows/release-trigger.yaml | 27 ++++++++++++++------------ core/pyproject.toml | 2 +- services/dns/pyproject.toml | 4 +--- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release-trigger.yaml b/.github/workflows/release-trigger.yaml index f180408d..373cfd0d 100644 --- a/.github/workflows/release-trigger.yaml +++ b/.github/workflows/release-trigger.yaml @@ -12,20 +12,23 @@ jobs: - uses: actions/checkout@v2 - name: Push tag for each updated package run: | - git config --global user.name "GitHub Action" - git config --global user.email "github-action@github.com" + git config --global user.name "SDK Releaser Bot" + git config --global user.email "noreply@stackit.de" for file in $(git diff --name-only HEAD~1..HEAD | grep pyproject.toml); do if git diff HEAD~1..HEAD $file | grep "version ="; then - dirpath=$(dirname $file) - version=$(grep -o "version = .*" ${file} | cut -d '=' -f 2-) - dirpath=$(dirname $file) - relpath=${file#*/core|stackit/*} - cleaned_version=$(echo "$version" | tr -d '" ') - tag=$(echo "${dirpath}/${cleaned_version}") - git tag -a $tag -m "Release $version" - git push origin --tags - else - echo "No change in version found." + version_changes=$(git diff HEAD~1..HEAD $file | grep "version =") + splitted_version_changes=($(echo "$version_changes" | grep -oP '(?<=version = )[^ ]*')) + # Check if all versions are equal + if [ $(echo "${splitted_version_changes[@]}" | tr ' ' '\n' | sort -u | wc -l) -ne 1 ]; then + dirpath=$(dirname $file) + current_version=$(grep -o "version = .*" ${file} | cut -d '=' -f 2-) + dirpath=$(dirname $file) + relpath=${file#*/core|stackit/*} + cleaned_version=$(echo "$current_version" | tr -d '" ') + tag=$(echo "${dirpath}/${cleaned_version}") + git tag -a $tag -m "Release $cleaned_version" + git push origin tag $tag + fi fi done \ No newline at end of file diff --git a/core/pyproject.toml b/core/pyproject.toml index 825e10ae..9b2d4eb3 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-core" -version = "0.0.1a3" +version = "0.0.1a" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index 1facefe8..d45211b4 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -1,8 +1,6 @@ [tool.poetry] name = "stackit-dns" - - -version = "0.0.1a3" +version = "0.0.1a" authors = [ "stackit-dns ", ] From d6ac0403f718fe38cc7182b204ad1d48ef25ced9 Mon Sep 17 00:00:00 2001 From: SDK Releaser Bot Date: Tue, 12 Nov 2024 08:18:35 +0100 Subject: [PATCH 21/24] reset core version --- core/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pyproject.toml b/core/pyproject.toml index 9b2d4eb3..ba89996d 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-core" -version = "0.0.1a" +version = "0.0.1a1" authors = [ "STACKIT Developer Tools ", ] From 186fc989b65a90c3140a8b98d7acb785afef5653 Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Tue, 12 Nov 2024 10:27:08 +0000 Subject: [PATCH 22/24] test --- core/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pyproject.toml b/core/pyproject.toml index ba89996d..5d6f7ede 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-core" -version = "0.0.1a1" +version = "0.0.1a2" authors = [ "STACKIT Developer Tools ", ] From 5d25109544995592ed216f0ead54146fb93316fd Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Tue, 12 Nov 2024 10:28:40 +0000 Subject: [PATCH 23/24] test --- core/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pyproject.toml b/core/pyproject.toml index 5d6f7ede..9b2d4eb3 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stackit-core" -version = "0.0.1a2" +version = "0.0.1a" authors = [ "STACKIT Developer Tools ", ] From 3d95d1691b49544a6cfe4864c1e741d408b8e656 Mon Sep 17 00:00:00 2001 From: Melvin Klein Date: Tue, 12 Nov 2024 10:29:03 +0000 Subject: [PATCH 24/24] add more comments --- .github/workflows/release-trigger.yaml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-trigger.yaml b/.github/workflows/release-trigger.yaml index 373cfd0d..c6d1862b 100644 --- a/.github/workflows/release-trigger.yaml +++ b/.github/workflows/release-trigger.yaml @@ -15,20 +15,24 @@ jobs: git config --global user.name "SDK Releaser Bot" git config --global user.email "noreply@stackit.de" - for file in $(git diff --name-only HEAD~1..HEAD | grep pyproject.toml); do - if git diff HEAD~1..HEAD $file | grep "version ="; then - version_changes=$(git diff HEAD~1..HEAD $file | grep "version =") + for file in $(git diff --name-only HEAD~1..HEAD | grep pyproject.toml); do + # Extract the change regarding the version from the pyproject.toml file + version_changes=$(git diff HEAD~1..HEAD $file | grep "version =") + # Check if the extracted change is not empty + if [ -n "$version_changes" ]; then + # Split all found version changes, so we can compare the old and new version. splitted_version_changes=($(echo "$version_changes" | grep -oP '(?<=version = )[^ ]*')) - # Check if all versions are equal - if [ $(echo "${splitted_version_changes[@]}" | tr ' ' '\n' | sort -u | wc -l) -ne 1 ]; then - dirpath=$(dirname $file) + # Only create a tag if there has been an actual change in the version, not just a format change. + if [ $(echo "${splitted_version_changes[@]}" | tr ' ' '\n' | sort -u | wc -l) -ne 1 ]; then + dirpath=$(dirname $file) + # Extract just the version number current_version=$(grep -o "version = .*" ${file} | cut -d '=' -f 2-) dirpath=$(dirname $file) - relpath=${file#*/core|stackit/*} cleaned_version=$(echo "$current_version" | tr -d '" ') - tag=$(echo "${dirpath}/${cleaned_version}") - git tag -a $tag -m "Release $cleaned_version" - git push origin tag $tag + # Create the tag based on the updated service and the new version + tag=$(echo "${dirpath}/${cleaned_version}") + git tag -a $tag -m "Release $cleaned_version" + git push origin tag $tag fi fi done \ No newline at end of file