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
15 changes: 1 addition & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,7 @@ jobs:

- name: Bump new dev version
if: github.event_name != 'release'
run: |
git config user.name "Marcelo Duarte"
git config user.email marcelotduarte@users.noreply.github.com
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
VERSION=$(uv version --short)
if (echo "$VERSION" | grep -q "\.dev"); then
uv version --no-sync --bump dev=$SOURCE_DATE_EPOCH
else
uv version --no-sync --bump patch --bump dev=$SOURCE_DATE_EPOCH
fi
NEW_VERSION=$(uv version --short)
git checkout -b build-$NEW_VERSION
git commit -m "Bump version: ${VERSION} → ${NEW_VERSION} [ci skip]" -a
git log -2
run: ./ci/bump-version.sh build-dev

- name: Build sdist and wheels
run: ./ci/build-wheel.sh "${{ matrix.tag }}"
Expand Down
24 changes: 0 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,3 @@ cov: wheel
coverage combine --keep --quiet -a $(COV_TMPDIR)/
coverage report
coverage html --show-contexts

.PHONY: release
release:
uv version
@echo "Run:"
@echo " uv version <new-version>"
@echo "--or--"
@echo " uv version --bump <major|minor|patch>"
@echo "--then--"
@echo " git push origin `git branch --show-current`"
@echo " git push origin `git branch --show-current` --tags"

.PHONY: release-dev
release-dev:
git checkout -B release main
if (uv version --short | grep -q "\.dev"); then\
uv version --bump dev;\
else\
uv version --bump patch --bump dev=0;\
fi
git commit -m "Bump dev version: `uv version --short` [ci skip]" -a
git push origin `git branch --show-current`
git push origin `git branch --show-current` --tags
git log -1
89 changes: 89 additions & 0 deletions ci/bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash

# Get script directory (without using /usr/bin/realpath)
_CI_DIR=$(dirname "${BASH_SOURCE[0]}")
CI_DIR=$(cd "$_CI_DIR" && pwd)

# Python information (platform and version)
if ! which uv &>/dev/null; then
# Install/update uv
"$CI_DIR/install-tools.sh" --dev
fi

# Usage
_usage () {
echo "Usage:"
echo "$0 <major|minor|patch|dev|stable>"
echo "Based on:"
echo " https://docs.astral.sh/uv/reference/cli/#uv-version--bump"
echo "Also can be used as:"
echo "$0 <major-dev|minor-dev|patch-dev|build-dev>"
}

if [ -z "$1" ] || [ "$1" == "--help" ]; then
_usage
exit 1
fi

echo "::group::Bump new version"
VERSION=$(uv version --short)
if [ "$1" == "major" ] || [ "$1" == "minor" ] || [ "$1" == "patch" ]; then
uv version --no-sync --bump "$1"
exit_value=$?
elif [ "$1" == "stable" ]; then
uv version --no-sync --bump stable
exit_value=$?
if [ $exit_value != 0 ]; then
echo "You must create a <dev> release first."
exit $exit_value
fi
elif [ "$1" == "dev" ]; then
if (echo "$VERSION" | grep -q "\.dev"); then
uv version --no-sync --bump dev
else
uv version --no-sync --bump patch --bump dev=0
fi
exit_value=$?
elif [ "$1" == "build-dev" ]; then
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
if (echo "$VERSION" | grep -q "\.dev"); then
uv version --no-sync --bump dev="$SOURCE_DATE_EPOCH"
else
uv version --no-sync --bump patch --bump dev="$SOURCE_DATE_EPOCH"
fi
exit_value=$?
elif [ "$1" == "major-dev" ] || [ "$1" == "minor-dev" ] || [ "$1" == "patch-dev" ]; then
if (echo "$VERSION" | grep -q "\.dev"); then
echo "error: to increase an <dev> version, use <dev> option or <build-dev> option."
exit 1
fi
if [ "$1" == "major-dev" ]; then
uv version --no-sync --bump major --bump dev=0
elif [ "$1" == "minor-dev" ]; then
uv version --no-sync --bump minor --bump dev=0
elif [ "$1" == "patch-dev" ]; then
uv version --no-sync --bump patch --bump dev=0
fi
exit_value=$?
else
echo "error: invalid option: $1"
exit 1
fi
if [ $exit_value != 0 ]; then
exit $exit_value
fi
NEW_VERSION=$(uv version --short)
if ! (git config --get user.email | grep -q "@"); then
git config user.name "Marcelo Duarte"
git config user.email marcelotduarte@users.noreply.github.com
fi
if (git branch --show-current | grep -q "main"); then
git checkout -B release main
fi
git commit -m "Bump version: ${VERSION} → ${NEW_VERSION} [ci skip]" -a
git log -1
if ! [ "$CI" == "true" ]; then
git push origin "$(git branch --show-current)"
git push origin "$(git branch --show-current)" --tags
fi
echo "::endgroup::"
6 changes: 3 additions & 3 deletions ci/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mkdir -p "$INSTALL_DIR"

if which python &>/dev/null; then
PY_PLATFORM=$(python -c "import sysconfig; print(sysconfig.get_platform(), end='')")
elif ! [ -n "$MINGW_PACKAGE_PREFIX" ]; then
elif [ -z "$MINGW_PACKAGE_PREFIX" ]; then
PY_PLATFORM="mingw"
else
PY_PLATFORM=""
Expand Down Expand Up @@ -46,7 +46,7 @@ if [ "$IS_CONDA" == "1" ]; then
SYS_PLATFORM=$(python -c "import sys; print(sys.platform, end='')")
# Packages to install
pkgs=("uv" "python-build")
if which python &>/dev/null; then
if ! which python &>/dev/null; then
pkgs+=("python=3.13")
fi

Expand Down Expand Up @@ -88,7 +88,7 @@ if [ "$IS_CONDA" == "1" ]; then
elif [ "$IS_MINGW" == "1" ]; then
# Packages to install
pkgs=("$MINGW_PACKAGE_PREFIX-uv" "$MINGW_PACKAGE_PREFIX-python-build")
if which python &>/dev/null; then
if ! which python &>/dev/null; then
pkgs+=("$MINGW_PACKAGE_PREFIX-python")
fi

Expand Down
Loading