Skip to content

chore: use version from tag for release #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
cd $PACKAGE_PATH
poetry publish --build --username="__token__" --no-interaction --password="${{ secrets.PYPI_TOKEN }}"
34 changes: 34 additions & 0 deletions .github/workflows/release-trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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
if git diff HEAD~1..HEAD $file | grep "version ="; then
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
2 changes: 1 addition & 1 deletion services/dns/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
"""
Loading