Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
Expand All @@ -31,6 +33,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__/
# Distribution / packaging
.Python
build/
src/Tables/_version.py
develop-eggs/
dist/
downloads/
Expand Down
34 changes: 13 additions & 21 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,49 +20,41 @@ In the ``root directory`` of this repository you will find a script called ``cre
When executing this script, it expects exactly one argument: the new name of the release / tag.
Here you need to provide always the syntax ``X.X.X``, e.g. ``0.1.9``, ``0.5.0`` or ``1.0.0``.

The script will do two things automatically for you:
1. Updating the version string in the **[\_\_about\_\_.py](src/Tables/__about__.py)**
2. Creating & Pushing a new tag to GitHub.
The package version is read from the Git tag. No version file needs to be changed or committed. Create and push a tag from the desired commit:

Execute the following command to create a new release:
```
cd <project-root-directory>
./create_release.sh 1.0.0
git checkout main
git pull origin main
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0
```

After executing the script, three pipeline jobs are getting triggered automatically:
After pushing the tag, three pipeline jobs are triggered automatically:
1. First job creates a new ``Release`` in github with the name of the created ``Tag``.
2. Second job uploads the new wheel package to ``PyPi`` with the ``__version__`` from the ``__about__.py`` file.
2. Second job builds the wheel with the version from the Git tag and uploads it to ``PyPi``.
3. Third job generates a new keyword documentation via ``libdoc`` on the main branch, but pushes it to the ``gh_pages`` where it is available as public ``GitHub Page``.

### *Backup* - Manual Version Bump & Tag Creation

If the preferred way using the ``create_release.sh`` script does not work, you can also manually create a new release.
Therefore, execute the following steps.

#### 1. Increase Version
#### Create a new tag

Open the file **[\_\_about\_\_.py](src/Tables/__about__.py)** and increase the version (``0.0.5 = major.minor.path``) before building & uploading the new python wheel package!

The new version **must be unique** & **not already existing** in ``PyPi`` & ``GitHub Releases``!!!

Commit & push the changed version into the ``main`` branch of the repository.

#### 2. Create new Tag

Now, create a new tag from the main branch with the syntax ``vX.X.X`` -> example: ``v1.0.5``.
Create a new tag from the desired commit with the syntax ``vX.X.X``. The version must be unique in PyPI and GitHub Releases.

Use the following commands to create & push the tag:
```
git tag v0.0.5
git push origin v0.0.5
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0
```

#### 2.1. Creating GitHub Release & Deploy Wheel Package to PyPi
#### Creating GitHub Release & Deploy Wheel Package to PyPi

After pushing the new tag, three pipeline jobs are getting triggered automatically:
1. First job creates a new ``Release`` in github with the name of the created ``Tag``.
2. Second job uploads the new wheel package to ``PyPi`` with the ``__version__`` from the ``__about__.py`` file.
2. Second job builds the wheel with the version from the Git tag and uploads it to ``PyPi``.
3. Third job generates a new keyword documentation via ``libdoc`` on the main branch, but pushes it to the ``gh_pages`` where it is available as public ``GitHub Page``.

## Installing Dev Dependencies
Expand Down
32 changes: 16 additions & 16 deletions create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ if [ -z "$1" ]; then
fi

NEW_VERSION="$1"
FILE="src/Tables/__about__.py"
TAG="v${NEW_VERSION}"

echo "🔧 Updating version to '${NEW_VERSION}' in '${FILE}'"

# Example: __version__ = "0.0.6" → __version__ = "0.0.7"
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' -E "s/^(__version__ *= *\")[^\"]+/\1${NEW_VERSION}/" src/Tables/__about__.py
else
sed -i.bak -E "s/^(__version__\s*=\s*\")[^\"]+\"/\1${NEW_VERSION}\"/" "$FILE"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "❌ Tag '${TAG}' already exists locally."
exit 1
fi

rm -f "${FILE}.bak"
if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
echo "❌ Tag '${TAG}' already exists on origin."
exit 1
fi

git checkout main
git add "$FILE"
git commit -m "Bump version to ${NEW_VERSION}"
git push origin HEAD
if ! git diff --quiet || ! git diff --cached --quiet; then
echo "❌ Working tree has uncommitted changes. Commit or stash them before creating a release."
exit 1
fi

git tag -a "v${NEW_VERSION}" -m "Release v${NEW_VERSION}"
git push origin "v${NEW_VERSION}"
echo "🏷️ Creating '${TAG}' on the current commit"
git tag -a "$TAG" -m "Release ${TAG}"
git push origin "$TAG"

echo "✅ Version bumped to '${NEW_VERSION}', committed and tagged. PyPi Release is going to be created... 🚀"
echo "✅ Tag '${TAG}' created and pushed. GitHub Actions will build and publish the release."
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -60,7 +60,10 @@ only-include = ["src/Tables"]
sources = ["src"]

[tool.hatch.version]
path = "src/Tables/__about__.py"
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "src/Tables/_version.py"

[tool.hatch.build]
dev-mode-dirs = ["src"]
Expand Down Expand Up @@ -93,7 +96,7 @@ source_pkgs = ["Tables", "tests"]
branch = true
parallel = true
omit = [
"src/Tables/__about__.py",
"src/Tables/_version.py",
]

[tool.coverage.paths]
Expand Down
4 changes: 0 additions & 4 deletions src/Tables/__about__.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/Tables/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from Tables.utils.settings_stack import Scope, SettingsStack

from .__about__ import __version__
from ._version import __version__
from .keywords import (
Configuration,
Getter,
Expand Down
Loading