Skip to content

Commit b96f552

Browse files
committed
fix(ci): make sure that alphaa depends on alpha
1 parent 75c6910 commit b96f552

File tree

3 files changed

+46
-11
lines changed

3 files changed

+46
-11
lines changed

.github/workflows/publish.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,31 @@ jobs:
112112
f.write(content)
113113
114114
# Update dependency constraints in pyproject.toml files
115+
# For alpha/beta/rc versions, use exact version (==)
116+
# For stable versions, use compatible release (~=)
115117
dep_files = [
116118
'packages/myfy-web/pyproject.toml',
117119
'packages/myfy-cli/pyproject.toml',
118120
'packages/myfy-frontend/pyproject.toml',
119121
'packages/myfy/pyproject.toml'
120122
]
121123
124+
# Determine constraint operator based on version type
125+
is_prerelease = 'a' in version or 'b' in version or 'rc' in version
126+
if is_prerelease:
127+
# For pre-releases, use exact version match
128+
constraint = f'=={version}'
129+
else:
130+
# For stable releases, use compatible release
131+
constraint = f'~={base_version}'
132+
122133
for file in dep_files:
123134
with open(file, 'r') as f:
124135
content = f.read()
125136
126-
content = re.sub(r'myfy-core~=[0-9a-z.]+', f'myfy-core~={base_version}', content)
127-
content = re.sub(r'myfy-web~=[0-9a-z.]+', f'myfy-web~={base_version}', content)
128-
content = re.sub(r'myfy-cli~=[0-9a-z.]+', f'myfy-cli~={base_version}', content)
137+
content = re.sub(r'myfy-core[~=]=?[0-9a-z.]+', f'myfy-core{constraint}', content)
138+
content = re.sub(r'myfy-web[~=]=?[0-9a-z.]+', f'myfy-web{constraint}', content)
139+
content = re.sub(r'myfy-cli[~=]=?[0-9a-z.]+', f'myfy-cli{constraint}', content)
129140
130141
with open(file, 'w') as f:
131142
f.write(content)

.github/workflows/release.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,30 @@ jobs:
132132
f.write(content)
133133
134134
# Update dependency constraints
135+
# For alpha/beta/rc versions, use exact version (==)
136+
# For stable versions, use compatible release (~=)
135137
dep_files = [
136138
'packages/myfy-web/pyproject.toml',
137139
'packages/myfy-cli/pyproject.toml',
138140
'packages/myfy-frontend/pyproject.toml',
139141
'packages/myfy/pyproject.toml'
140142
]
141143
144+
# Determine constraint operator based on version type
145+
is_prerelease = 'a' in version or 'b' in version or 'rc' in version
146+
if is_prerelease:
147+
# For pre-releases, use exact version match
148+
constraint = f'=={version}'
149+
else:
150+
# For stable releases, use compatible release
151+
constraint = f'~={base_version}'
152+
142153
for file in dep_files:
143154
with open(file, 'r') as f:
144155
content = f.read()
145-
content = re.sub(r'myfy-core~=[0-9a-z.]+', f'myfy-core~={base_version}', content)
146-
content = re.sub(r'myfy-web~=[0-9a-z.]+', f'myfy-web~={base_version}', content)
147-
content = re.sub(r'myfy-cli~=[0-9a-z.]+', f'myfy-cli~={base_version}', content)
156+
content = re.sub(r'myfy-core[~=]=?[0-9a-z.]+', f'myfy-core{constraint}', content)
157+
content = re.sub(r'myfy-web[~=]=?[0-9a-z.]+', f'myfy-web{constraint}', content)
158+
content = re.sub(r'myfy-cli[~=]=?[0-9a-z.]+', f'myfy-cli{constraint}', content)
148159
with open(file, 'w') as f:
149160
f.write(content)
150161

PUBLISHING.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,32 @@ We use two versioning approaches:
6262

6363
### Dependency Constraints
6464

65-
Internal dependencies use **compatible release** constraints (`~=`):
65+
Internal dependencies use **different constraints** based on release type:
6666

67+
**For stable releases** (`~=` - compatible release):
6768
```toml
6869
# Example: myfy-web depends on myfy-core
6970
dependencies = [
70-
"myfy-core~=0.1.0", # Allows 0.1.x but not 0.2.0
71+
"myfy-core~=1.0.0", # Allows 1.0.x but not 1.1.0
7172
]
7273
```
7374

75+
**For pre-releases** (`==` - exact version):
76+
```toml
77+
# Example: alpha versions
78+
dependencies = [
79+
"myfy-core==0.1.0a15", # Exact match required
80+
]
81+
```
82+
83+
**Why different constraints?**
84+
- **Pre-releases (alpha/beta/rc)**: Use exact version (`==`) because `~=` doesn't work with pre-release versions in pip
85+
- **Stable releases**: Use compatible release (`~=`) to allow patch updates while preventing breaking changes
86+
7487
This ensures:
75-
- Patch updates are automatically compatible
76-
- Minor/major updates require explicit version alignment
77-
- Users get the correct package versions together
88+
- Alpha versions install together correctly
89+
- Stable releases allow automatic patch updates
90+
- Users get compatible package versions
7891

7992
## Publishing Workflows
8093

0 commit comments

Comments
 (0)