diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 11bd2518..1645a7cc 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -31,5 +31,5 @@ jobs: - name: Build & Publish to PyPi run: | pip install poetry - cd $PACKAGE_PATH - poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}" \ No newline at end of file + cd $PACKAGE_PATH + poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}" diff --git a/.github/workflows/release-trigger.yaml b/.github/workflows/release-trigger.yaml new file mode 100644 index 00000000..c6d1862b --- /dev/null +++ b/.github/workflows/release-trigger.yaml @@ -0,0 +1,38 @@ +name: Check Version Update + +on: + push: + branches: + - main + +jobs: + check-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Push tag for each updated package + run: | + 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 + # 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 = )[^ ]*')) + # 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) + cleaned_version=$(echo "$current_version" | tr -d '" ') + # 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 diff --git a/core/pyproject.toml b/core/pyproject.toml index ba89996d..9b2d4eb3 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.1a" authors = [ "STACKIT Developer Tools ", ] diff --git a/services/dns/pyproject.toml b/services/dns/pyproject.toml index 8a0cd6c6..d45211b4 100644 --- a/services/dns/pyproject.toml +++ b/services/dns/pyproject.toml @@ -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 +"""