diff --git a/.github/workflows/beta-release.yml b/.github/workflows/beta-release.yml index fe747c33..79aae4d6 100644 --- a/.github/workflows/beta-release.yml +++ b/.github/workflows/beta-release.yml @@ -62,7 +62,7 @@ jobs: with: fetch-depth: 0 ref: dev - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GH_PAT }} - name: Set up Python uses: actions/setup-python@v5 @@ -86,21 +86,34 @@ jobs: id: version run: | set -e + + # Fetch all tags to ensure we have the complete tag history + git fetch --tags + CURRENT_VERSION=$(python -c "from datafog.__about__ import __version__; print(__version__)") echo "Current version: $CURRENT_VERSION" + # Extract base version (remove any alpha/beta suffix) if [[ $CURRENT_VERSION == *"b"* ]]; then BASE_VERSION=$(echo $CURRENT_VERSION | cut -d'b' -f1) - BETA_NUM=$(echo $CURRENT_VERSION | cut -d'b' -f2) - BETA_VERSION="${BASE_VERSION}b$((BETA_NUM + 1))" elif [[ $CURRENT_VERSION == *"a"* ]]; then BASE_VERSION=$(echo $CURRENT_VERSION | cut -d'a' -f1) - BETA_VERSION="${BASE_VERSION}b1" else - BASE_VERSION=$(python3 -c "import sys; version='$CURRENT_VERSION'; parts=version.split('.'); parts[1]=str(int(parts[1])+1); parts[2]='0'; print('.'.join(parts))") - BETA_VERSION="${BASE_VERSION}b1" + BASE_VERSION=$CURRENT_VERSION fi + echo "Base version: $BASE_VERSION" + + # Find the next available beta version by checking existing tags + BETA_NUM=1 + while git tag -l "v${BASE_VERSION}b${BETA_NUM}" | grep -q "v${BASE_VERSION}b${BETA_NUM}"; do + echo "Tag v${BASE_VERSION}b${BETA_NUM} already exists" + BETA_NUM=$((BETA_NUM + 1)) + done + + BETA_VERSION="${BASE_VERSION}b${BETA_NUM}" + echo "Next available beta version: $BETA_VERSION" + echo "beta_version=$BETA_VERSION" >> $GITHUB_OUTPUT sed -i "s/__version__ = \".*\"/__version__ = \"$BETA_VERSION\"/" datafog/__about__.py sed -i "s/version=\".*\"/version=\"$BETA_VERSION\"/" setup.py @@ -126,9 +139,9 @@ jobs: echo "Running integration tests..." python run_tests.py -m integration --no-header - # Run benchmark tests with optimal performance (no memory debugging) - echo "Running benchmark tests with performance optimizations..." - OMP_NUM_THREADS=4 MKL_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 python -m pytest tests/benchmark_text_service.py -v --no-header --benchmark-skip + # Run simple performance validation (no pytest-benchmark dependency) + echo "Running simple performance validation..." + OMP_NUM_THREADS=4 MKL_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 python tests/simple_performance_test.py - name: Build package run: | @@ -137,7 +150,7 @@ jobs: - name: Create GitHub release env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_PAT }} run: | BETA_VERSION="${{ steps.version.outputs.beta_version }}" git add datafog/__about__.py setup.py @@ -169,7 +182,7 @@ jobs: - name: Cleanup old betas env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_PAT }} run: | BETA_RELEASES=$(gh release list --limit 30 | grep b | tail -n +6 | cut -f3) diff --git a/datafog/__about__.py b/datafog/__about__.py index 0fd7811c..afcedcd6 100644 --- a/datafog/__about__.py +++ b/datafog/__about__.py @@ -1 +1 @@ -__version__ = "4.2.0" +__version__ = "4.2.0b1" diff --git a/scripts/generate_changelog.py b/scripts/generate_changelog.py index 8050a8c8..91b4f0f4 100755 --- a/scripts/generate_changelog.py +++ b/scripts/generate_changelog.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """Generate changelog for weekly releases.""" +import argparse import re import subprocess from datetime import datetime @@ -60,7 +61,7 @@ def categorize_commits(commits): return categories -def generate_changelog(): +def generate_changelog(beta=False): """Generate changelog content.""" latest_tag = get_latest_tag() commits = get_commits_since_tag(latest_tag) @@ -70,8 +71,13 @@ def generate_changelog(): categories = categorize_commits(commits) - changelog = "# What's New\n\n" - changelog += f"*Released: {datetime.now().strftime('%Y-%m-%d')}*\n\n" + if beta: + changelog = "# Beta Release Notes\n\n" + changelog += f"*Beta Release: {datetime.now().strftime('%Y-%m-%d')}*\n\n" + changelog += "⚠️ **This is a beta release for testing purposes.**\n\n" + else: + changelog = "# What's New\n\n" + changelog += f"*Released: {datetime.now().strftime('%Y-%m-%d')}*\n\n" if categories["features"]: changelog += "## 🚀 New Features\n" @@ -121,13 +127,23 @@ def generate_changelog(): if __name__ == "__main__": - changelog_content = generate_changelog() + parser = argparse.ArgumentParser(description="Generate changelog for releases") + parser.add_argument( + "--beta", action="store_true", help="Generate beta release changelog" + ) + parser.add_argument( + "--output", help="Output file name", default="CHANGELOG_LATEST.md" + ) + + args = parser.parse_args() + + changelog_content = generate_changelog(beta=args.beta) # Write to file for GitHub release - with open("CHANGELOG_LATEST.md", "w") as f: + with open(args.output, "w") as f: f.write(changelog_content) - print("✅ Changelog generated: CHANGELOG_LATEST.md") + print(f"✅ Changelog generated: {args.output}") print("\nPreview:") print("=" * 50) print(changelog_content)