Skip to content

Commit d10e8e2

Browse files
authored
Merge pull request #107 from DataFog/fix/beta-workflow-changelog-v2
fix(ci): resolve beta release workflow failures
2 parents 4896050 + ae03269 commit d10e8e2

File tree

3 files changed

+47
-18
lines changed

3 files changed

+47
-18
lines changed

.github/workflows/beta-release.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
with:
6363
fetch-depth: 0
6464
ref: dev
65-
token: ${{ secrets.GITHUB_TOKEN }}
65+
token: ${{ secrets.GH_PAT }}
6666

6767
- name: Set up Python
6868
uses: actions/setup-python@v5
@@ -86,21 +86,34 @@ jobs:
8686
id: version
8787
run: |
8888
set -e
89+
90+
# Fetch all tags to ensure we have the complete tag history
91+
git fetch --tags
92+
8993
CURRENT_VERSION=$(python -c "from datafog.__about__ import __version__; print(__version__)")
9094
echo "Current version: $CURRENT_VERSION"
9195
96+
# Extract base version (remove any alpha/beta suffix)
9297
if [[ $CURRENT_VERSION == *"b"* ]]; then
9398
BASE_VERSION=$(echo $CURRENT_VERSION | cut -d'b' -f1)
94-
BETA_NUM=$(echo $CURRENT_VERSION | cut -d'b' -f2)
95-
BETA_VERSION="${BASE_VERSION}b$((BETA_NUM + 1))"
9699
elif [[ $CURRENT_VERSION == *"a"* ]]; then
97100
BASE_VERSION=$(echo $CURRENT_VERSION | cut -d'a' -f1)
98-
BETA_VERSION="${BASE_VERSION}b1"
99101
else
100-
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))")
101-
BETA_VERSION="${BASE_VERSION}b1"
102+
BASE_VERSION=$CURRENT_VERSION
102103
fi
103104
105+
echo "Base version: $BASE_VERSION"
106+
107+
# Find the next available beta version by checking existing tags
108+
BETA_NUM=1
109+
while git tag -l "v${BASE_VERSION}b${BETA_NUM}" | grep -q "v${BASE_VERSION}b${BETA_NUM}"; do
110+
echo "Tag v${BASE_VERSION}b${BETA_NUM} already exists"
111+
BETA_NUM=$((BETA_NUM + 1))
112+
done
113+
114+
BETA_VERSION="${BASE_VERSION}b${BETA_NUM}"
115+
echo "Next available beta version: $BETA_VERSION"
116+
104117
echo "beta_version=$BETA_VERSION" >> $GITHUB_OUTPUT
105118
sed -i "s/__version__ = \".*\"/__version__ = \"$BETA_VERSION\"/" datafog/__about__.py
106119
sed -i "s/version=\".*\"/version=\"$BETA_VERSION\"/" setup.py
@@ -126,9 +139,9 @@ jobs:
126139
echo "Running integration tests..."
127140
python run_tests.py -m integration --no-header
128141
129-
# Run benchmark tests with optimal performance (no memory debugging)
130-
echo "Running benchmark tests with performance optimizations..."
131-
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
142+
# Run simple performance validation (no pytest-benchmark dependency)
143+
echo "Running simple performance validation..."
144+
OMP_NUM_THREADS=4 MKL_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 python tests/simple_performance_test.py
132145
133146
- name: Build package
134147
run: |
@@ -137,7 +150,7 @@ jobs:
137150
138151
- name: Create GitHub release
139152
env:
140-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
153+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
141154
run: |
142155
BETA_VERSION="${{ steps.version.outputs.beta_version }}"
143156
git add datafog/__about__.py setup.py
@@ -169,7 +182,7 @@ jobs:
169182
170183
- name: Cleanup old betas
171184
env:
172-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
173186
run: |
174187
BETA_RELEASES=$(gh release list --limit 30 | grep b | tail -n +6 | cut -f3)
175188

datafog/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.2.0"
1+
__version__ = "4.2.0b1"

scripts/generate_changelog.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
"""Generate changelog for weekly releases."""
33

4+
import argparse
45
import re
56
import subprocess
67
from datetime import datetime
@@ -60,7 +61,7 @@ def categorize_commits(commits):
6061
return categories
6162

6263

63-
def generate_changelog():
64+
def generate_changelog(beta=False):
6465
"""Generate changelog content."""
6566
latest_tag = get_latest_tag()
6667
commits = get_commits_since_tag(latest_tag)
@@ -70,8 +71,13 @@ def generate_changelog():
7071

7172
categories = categorize_commits(commits)
7273

73-
changelog = "# What's New\n\n"
74-
changelog += f"*Released: {datetime.now().strftime('%Y-%m-%d')}*\n\n"
74+
if beta:
75+
changelog = "# Beta Release Notes\n\n"
76+
changelog += f"*Beta Release: {datetime.now().strftime('%Y-%m-%d')}*\n\n"
77+
changelog += "⚠️ **This is a beta release for testing purposes.**\n\n"
78+
else:
79+
changelog = "# What's New\n\n"
80+
changelog += f"*Released: {datetime.now().strftime('%Y-%m-%d')}*\n\n"
7581

7682
if categories["features"]:
7783
changelog += "## 🚀 New Features\n"
@@ -121,13 +127,23 @@ def generate_changelog():
121127

122128

123129
if __name__ == "__main__":
124-
changelog_content = generate_changelog()
130+
parser = argparse.ArgumentParser(description="Generate changelog for releases")
131+
parser.add_argument(
132+
"--beta", action="store_true", help="Generate beta release changelog"
133+
)
134+
parser.add_argument(
135+
"--output", help="Output file name", default="CHANGELOG_LATEST.md"
136+
)
137+
138+
args = parser.parse_args()
139+
140+
changelog_content = generate_changelog(beta=args.beta)
125141

126142
# Write to file for GitHub release
127-
with open("CHANGELOG_LATEST.md", "w") as f:
143+
with open(args.output, "w") as f:
128144
f.write(changelog_content)
129145

130-
print("✅ Changelog generated: CHANGELOG_LATEST.md")
146+
print(f"✅ Changelog generated: {args.output}")
131147
print("\nPreview:")
132148
print("=" * 50)
133149
print(changelog_content)

0 commit comments

Comments
 (0)