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 all 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 }}"
38 changes: 38 additions & 0 deletions .github/workflows/release-trigger.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "stackit-core"
version = "0.0.1a1"
version = "0.0.1a"
authors = [
"STACKIT Developer Tools <developer-tools@stackit.cloud>",
]
Expand Down
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