Skip to content

Commit 3d95d16

Browse files
committed
add more comments
1 parent 5d25109 commit 3d95d16

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

.github/workflows/release-trigger.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,24 @@ jobs:
1515
git config --global user.name "SDK Releaser Bot"
1616
git config --global user.email "[email protected]"
1717
18-
for file in $(git diff --name-only HEAD~1..HEAD | grep pyproject.toml); do
19-
if git diff HEAD~1..HEAD $file | grep "version ="; then
20-
version_changes=$(git diff HEAD~1..HEAD $file | grep "version =")
18+
for file in $(git diff --name-only HEAD~1..HEAD | grep pyproject.toml); do
19+
# Extract the change regarding the version from the pyproject.toml file
20+
version_changes=$(git diff HEAD~1..HEAD $file | grep "version =")
21+
# Check if the extracted change is not empty
22+
if [ -n "$version_changes" ]; then
23+
# Split all found version changes, so we can compare the old and new version.
2124
splitted_version_changes=($(echo "$version_changes" | grep -oP '(?<=version = )[^ ]*'))
22-
# Check if all versions are equal
23-
if [ $(echo "${splitted_version_changes[@]}" | tr ' ' '\n' | sort -u | wc -l) -ne 1 ]; then
24-
dirpath=$(dirname $file)
25+
# Only create a tag if there has been an actual change in the version, not just a format change.
26+
if [ $(echo "${splitted_version_changes[@]}" | tr ' ' '\n' | sort -u | wc -l) -ne 1 ]; then
27+
dirpath=$(dirname $file)
28+
# Extract just the version number
2529
current_version=$(grep -o "version = .*" ${file} | cut -d '=' -f 2-)
2630
dirpath=$(dirname $file)
27-
relpath=${file#*/core|stackit/*}
2831
cleaned_version=$(echo "$current_version" | tr -d '" ')
29-
tag=$(echo "${dirpath}/${cleaned_version}")
30-
git tag -a $tag -m "Release $cleaned_version"
31-
git push origin tag $tag
32+
# Create the tag based on the updated service and the new version
33+
tag=$(echo "${dirpath}/${cleaned_version}")
34+
git tag -a $tag -m "Release $cleaned_version"
35+
git push origin tag $tag
3236
fi
3337
fi
3438
done

0 commit comments

Comments
 (0)