Skip to content

Commit 032e02f

Browse files
authored
Merge pull request #103 from forcedotcom/pre-release-fix
Allow for pep440 releases
2 parents 30a9827 + 35bb724 commit 032e02f

4 files changed

Lines changed: 68 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,30 @@ on:
55
types: [published]
66

77
jobs:
8+
validate-release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Validate pre-release consistency
12+
env:
13+
TAG_NAME: ${{ github.event.release.tag_name }}
14+
IS_PRERELEASE: ${{ github.event.release.prerelease }}
15+
run: |
16+
PEP440_PRE=$(echo "$TAG_NAME" | grep -qE '(\.dev|a|b|rc)[0-9]+' && echo "true" || echo "false")
17+
18+
if [ "$IS_PRERELEASE" = "true" ] && [ "$PEP440_PRE" = "false" ]; then
19+
echo "::error::GitHub release is marked as pre-release but tag '$TAG_NAME' is a stable version. Use a PEP 440 pre-release suffix (e.g. .dev1, rc1)."
20+
exit 1
21+
fi
22+
23+
if [ "$IS_PRERELEASE" = "false" ] && [ "$PEP440_PRE" = "true" ]; then
24+
echo "::error::Tag '$TAG_NAME' has a pre-release suffix but the GitHub release is not marked as pre-release. Check the 'Set as a pre-release' box."
25+
exit 1
26+
fi
27+
28+
echo "Release consistency check passed: tag=$TAG_NAME, prerelease=$IS_PRERELEASE"
29+
830
publish:
31+
needs: validate-release
932
runs-on: ubuntu-latest
1033
environment:
1134
name: pypi
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Released Version Check
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
check-stable-resolution:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Wait for PyPI indexing
13+
run: sleep 180
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.11'
19+
20+
- name: Install from PyPI (no --pre)
21+
run: |
22+
python -m venv /tmp/check-venv
23+
/tmp/check-venv/bin/pip install salesforce-data-customcode
24+
25+
- name: Verify resolved version is stable
26+
run: |
27+
VERSION=$(/tmp/check-venv/bin/pip show salesforce-data-customcode | grep ^Version: | awk '{print $2}')
28+
echo "Resolved version: $VERSION"
29+
if echo "$VERSION" | grep -qE '(\.dev|a|b|rc)[0-9]+'; then
30+
echo "::error::pip install (no --pre) resolved to pre-release version: $VERSION"
31+
exit 1
32+
fi
33+
echo "Version $VERSION is stable."

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,17 @@ See the [Prerequisites section in README.md](./README.md#prerequisites) for comp
7878

7979
**Tip**: See the [README.md](./README.md) for additional `datacustomcode` commands (`scan`, `deploy`, `zip`) to test specific code paths and validate your SDK changes thoroughly.
8080

81+
## Versioning and Pre-Releases
82+
83+
This project uses [PEP 440](https://peps.python.org/pep-0440/) version syntax. Versions are derived automatically from git tags via `poetry-dynamic-versioning`.
84+
85+
- **Stable releases** use tags like `v4.1.0` → published as `4.1.0` on PyPI.
86+
- **Pre-releases** use tags like `v4.1.0.dev1`, `v4.1.0rc1` → published as `4.1.0.dev1`, `4.1.0rc1` on PyPI.
87+
88+
Pre-release versions are **never** resolved by `pip install salesforce-data-customcode` unless the user explicitly passes `--pre`. This ensures customers always get stable releases by default.
89+
90+
A Github Action (`Released Version Check`) runs after every publish to verify that bare `pip install` still resolves to a stable version.
91+
8192
## Makefile Commands
8293

8394
```bash

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ datacustomcode = "datacustomcode.cli:cli"
134134
[tool.poetry-dynamic-versioning]
135135
enable = true
136136
pattern = "^v(?P<base>.+)$"
137-
style = "semver"
137+
style = "pep440"
138138
vcs = "git"
139139

140140
[tool.pytest.ini_options]

0 commit comments

Comments
 (0)