Skip to content

Commit 26bc606

Browse files
committed
add trigger for release
1 parent 3ccbba2 commit 26bc606

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Check Version Update
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
check-version:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- 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"
21+
- name: Check version update
22+
run: |
23+
git config --global user.name "GitHub Action"
24+
git config --global user.email "[email protected]"
25+
for file in ${{ steps.find-pyproject-toml-files.outputs.pyproject_toml_files }}; do
26+
git diff --quiet HEAD~1..HEAD $file || true
27+
if git diff --quiet HEAD~1..HEAD $file; then
28+
echo "No changes in $file"
29+
else
30+
version_line=$(git diff HEAD~1..HEAD $file | grep "^+.*version = ")
31+
if [ -n "$version_line" ]; then
32+
echo "Version updated in $file"
33+
# Run your action here
34+
version=$(grep -o "version = .*" file.txt | cut -d '=' -f 2-)
35+
# Get the update package
36+
dirpath=$(dirname "$filepath")
37+
relpath=${filepath#*/core|stackit/*}
38+
tag = ${relpath}/${version}
39+
echo $tag
40+
git tag -a $version -m "Release $version"
41+
echo git status
42+
# git push origin --tags
43+
else
44+
echo "No version update in $file"
45+
fi
46+
fi
47+
done

0 commit comments

Comments
 (0)