Skip to content

Commit 18f0b58

Browse files
authored
fix: ensure semantic-release creates v1.0.0 with wheel uploads (#96)
- Add git reset to ensure workflow runs on exact commit SHA - Add ref checkout and Force branch to workflow SHA step - Add missing permissions (actions: read, issues: read) - Make dist_glob_patterns specific for .whl and .tar.gz files - Disable PyPI publishing (dist = false) until OIDC is configured - Add version_toml configuration for semantic-release to handle pyproject.toml - Update generate_pyproject.py to not overwrite semantic-release version updates - Simplify build target to let semantic-release handle versioning - Add custom release notes template with proper section ordering - Delete stray :wq! file - This ensures semantic-release works correctly and attaches build artifacts
1 parent 68b316e commit 18f0b58

6 files changed

Lines changed: 119 additions & 37 deletions

File tree

.github/workflows/semantic-release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ permissions:
2828
pull-requests: read
2929
id-token: write
3030
packages: write
31+
actions: read
32+
issues: read
3133

3234
jobs:
3335
release:
@@ -41,6 +43,11 @@ jobs:
4143
with:
4244
fetch-depth: 0
4345
token: ${{ secrets.GITHUB_TOKEN }}
46+
ref: ${{ github.ref_name }}
47+
48+
- name: Force branch to workflow SHA
49+
run: |
50+
git reset --hard ${{ github.sha }}
4451
4552
- name: Setup Python and UV
4653
uses: ./.github/actions/setup-python-uv
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
## {{ version.as_tag() }} ({{ version.commit_date.strftime("%Y-%m-%d") }})
2+
3+
_This release is published under the Apache-2.0 License._
4+
5+
{% if version.breaking_changes %}
6+
### Breaking Changes
7+
8+
{% for commit in version.breaking_changes %}
9+
- {{ commit.descriptions[0] | capitalize }}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
10+
{% endfor %}
11+
12+
{% endif %}
13+
{% if version.feature_commits %}
14+
### Features
15+
16+
{% for commit in version.feature_commits %}
17+
- {{ commit.descriptions[0] | capitalize }}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
18+
{% endfor %}
19+
20+
{% endif %}
21+
{% if version.fix_commits %}
22+
### Bug Fixes
23+
24+
{% for commit in version.fix_commits %}
25+
- {{ commit.descriptions[0] | capitalize }}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
26+
{% endfor %}
27+
28+
{% endif %}
29+
{% if version.performance_commits %}
30+
### Performance Improvements
31+
32+
{% for commit in version.performance_commits %}
33+
- {{ commit.descriptions[0] | capitalize }}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
34+
{% endfor %}
35+
36+
{% endif %}
37+
{% if version.refactor_commits %}
38+
### Refactoring
39+
40+
{% for commit in version.refactor_commits %}
41+
- {{ commit.descriptions[0] | capitalize }}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
42+
{% endfor %}
43+
44+
{% endif %}
45+
{% if version.chore_commits %}
46+
### Chores
47+
48+
{% for commit in version.chore_commits %}
49+
- {{ commit.descriptions[0] | capitalize }}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
50+
{% endfor %}
51+
52+
{% endif %}
53+
{% if version.documentation_commits %}
54+
### Documentation
55+
56+
{% for commit in version.documentation_commits %}
57+
- {{ commit.descriptions[0] | capitalize }}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
58+
{% endfor %}
59+
60+
{% endif %}
61+
{% if version.style_commits %}
62+
### Code Style
63+
64+
{% for commit in version.style_commits %}
65+
- {{ commit.descriptions[0] | capitalize }}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
66+
{% endfor %}
67+
68+
{% endif %}
69+
{% if version.test_commits %}
70+
### Tests
71+
72+
{% for commit in version.test_commits %}
73+
- {{ commit.descriptions[0] | capitalize %}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
74+
{% endfor %}
75+
76+
{% endif %}
77+
{% if version.build_commits %}
78+
### Build System
79+
80+
{% for commit in version.build_commits %}
81+
- {{ commit.descriptions[0] | capitalize %}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
82+
{% endfor %}
83+
84+
{% endif %}
85+
{% if version.ci_commits %}
86+
### Continuous Integration
87+
88+
{% for commit in version.ci_commits %}
89+
- {{ commit.descriptions[0] | capitalize %}{% if commit.scope %} ({{ commit.scope }}){% endif %} ([`{{ commit.short_hash }}`]({{ commit.hexsha | commit_hash_url }}))
90+
{% endfor %}
91+
92+
{% endif %}
93+
---
94+
95+
**Detailed Changes**: [{{ version.previous_version.as_tag() }}...{{ version.as_tag() }}]({{ version.previous_version.as_tag() | compare_url(version.as_tag()) }})

:wq!

Lines changed: 0 additions & 33 deletions
This file was deleted.

dev-tools/scripts/generate_pyproject.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ def update_pyproject_selective(pyproject_path: Path) -> None:
104104
lines = content.split("\n")
105105
new_lines = []
106106

107+
# Check if version was already updated by semantic-release
108+
current_version = None
109+
for line in lines:
110+
if line.strip().startswith('version = "'):
111+
current_version = line.strip().split('"')[1]
112+
break
113+
114+
# If current version is different from .project.yml, don't overwrite it
115+
# (semantic-release has already updated it)
116+
use_current_version = current_version and current_version != version
117+
107118
i = 0
108119
while i < len(lines):
109120
line = lines[i].strip()
@@ -115,7 +126,7 @@ def update_pyproject_selective(pyproject_path: Path) -> None:
115126
[
116127
"[project]",
117128
f'name = "{package_name}"',
118-
f'version = "{version}"',
129+
f'version = "{current_version if use_current_version else version}"',
119130
f'description = "{description}"',
120131
'readme = "README.md"',
121132
'license = "Apache-2.0"',

makefiles/deploy.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ ci-docs-deploy: ## Deploy documentation to GitHub Pages (matches docs.yml main
6161
# Dummy targets removed (consolidated in quality.mk)
6262

6363
# @SECTION Build & Deploy
64-
build: clean dev-install ## Build package
65-
VERSION=$${VERSION:-$$(make -s get-version)} $(MAKE) generate-pyproject && \
64+
build: clean venv-setup ## Build package
6665
VERSION=$${VERSION:-$$(make -s get-version)} BUILD_ARGS="$(BUILD_ARGS)" ./dev-tools/package/build.sh
6766

6867
build-test: build ## Build and test package installation

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ namespace_packages = true
286286

287287
[tool.semantic_release]
288288
version_variables = [".project.yml:project.version"]
289+
version_toml = ["pyproject.toml:project.version"]
289290
build_command = "make build"
290291
major_on_zero = true
291292
allow_zero_version = true
@@ -309,6 +310,7 @@ prerelease = true
309310

310311
[tool.semantic_release.changelog.default_templates]
311312
changelog_file = "CHANGELOG.md"
313+
template_dir = ".release-notes-templates"
312314

313315
[tool.semantic_release.commit_parser_options]
314316
minor_tags = ["feat"]
@@ -321,5 +323,6 @@ name = "origin"
321323
type = "github"
322324

323325
[tool.semantic_release.publish]
324-
dist_glob_patterns = ["dist/*"]
326+
dist = false
327+
dist_glob_patterns = ["dist/*.whl", "dist/*.tar.gz", "checksums.txt"]
325328
upload_to_vcs_release = true

0 commit comments

Comments
 (0)