Skip to content

Commit 1308d4c

Browse files
author
GitHub Action
committed
simplified
1 parent 3d5971d commit 1308d4c

File tree

1 file changed

+14
-30
lines changed

1 file changed

+14
-30
lines changed

.github/workflows/release-trigger.yaml

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,22 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
13-
- name: Find pyproject.toml files
14-
run: |
15-
pyproject_toml_files=$(git diff --name-only HEAD~1..HEAD | grep pyproject.toml)
16-
if [ -z "$pyproject_toml_files" ]; then
17-
echo "No pyproject.toml files changed"
18-
exit 0
19-
fi
20-
echo "pyproject_toml_files=$pyproject_toml_files" >> $GITHUB_ENV
21-
- name: Check version update
13+
- name: Push tag for each updated package
2214
run: |
2315
git config --global user.name "GitHub Action"
2416
git config --global user.email "github-action@github.com"
2517
26-
for file in ${pyproject_toml_files}; do
27-
if git diff HEAD~1..HEAD $file | grep "version ="; then
28-
dirpath=$(dirname $file)
29-
echo "pyproject.toml updated in $dirpath"
30-
# Run your action here
31-
version=$(grep -o "version = .*" ${file} | cut -d '=' -f 2-)
32-
dirpath=$(dirname $file)
33-
relpath=${file#*/core|stackit/*}
34-
cleaned_version=$(echo "$version" | tr -d '" ')
35-
tag=$(echo "${dirpath}/${cleaned_version}")
36-
echo $file
37-
echo $dirpath
38-
echo $cleaned_version
39-
echo $tag
40-
41-
#git tag -a $tag -m "Release $version"
42-
echo $(git status)
43-
# git push origin --tags
44-
else
45-
echo "No change in version found."
46-
fi
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+
dirpath=$(dirname $file)
21+
version=$(grep -o "version = .*" ${file} | cut -d '=' -f 2-)
22+
dirpath=$(dirname $file)
23+
relpath=${file#*/core|stackit/*}
24+
cleaned_version=$(echo "$version" | tr -d '" ')
25+
tag=$(echo "${dirpath}/${cleaned_version}")
26+
git tag -a $tag -m "Release $version"
27+
git push origin --tags
28+
else
29+
echo "No change in version found."
30+
fi
4731
done

0 commit comments

Comments
 (0)