File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : Publish to PyPI
1+ name : Release (release → PyPI)
22
33on :
44 push :
55 branches :
66 - release
77
8+ permissions :
9+ contents : write
10+ id-token : write
11+ pull-requests : write
12+
813jobs :
9- deploy :
10- name : Build and Publish to PyPI
14+ release :
1115 runs-on : ubuntu-latest
1216 environment : pypi-universalpython
13-
14- permissions :
15- id-token : write
1617
1718 steps :
1819 - uses : actions/checkout@v4
19-
20+ with :
21+ fetch-depth : 0
22+
2023 - name : Set up Python
2124 uses : actions/setup-python@v5
2225 with :
@@ -25,11 +28,28 @@ jobs:
2528 - name : Install dependencies
2629 run : |
2730 python -m pip install --upgrade pip
28- pip install build twine
31+ pip install build twine python-semantic-release
2932 pip install -r utils/requirements.txt
30-
33+
34+ - name : Create stable release
35+ env :
36+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37+ run : |
38+ semantic-release version --commit --tag --push
39+
3140 - name : Build package
3241 run : bash utils/build_package.sh
3342
3443 - name : Publish to PyPI
35- uses : pypa/gh-action-pypi-publish@release/v1
44+ uses : pypa/gh-action-pypi-publish@release/v1
45+
46+ - name : Create PR to sync release → main
47+ uses : peter-evans/create-pull-request@v5
48+ with :
49+ token : ${{ secrets.GITHUB_TOKEN }}
50+ base : main
51+ head : release
52+ title : " chore: merge release changes back into main"
53+ body : |
54+ This PR was created automatically after publishing a new PyPI release.
55+ It keeps `main` in sync with version and changelog updates.
Original file line number Diff line number Diff line change 1- name : Publish to Test PyPI
1+ name : Prerelease (main → TestPyPI)
22
33on :
44 push :
55 branches :
66 - main
77
8+ permissions :
9+ contents : write
10+ id-token : write
11+
812jobs :
9- deploy :
10- name : Build and Publish to Test PyPI
13+ prerelease :
1114 runs-on : ubuntu-latest
1215 environment : test-pypi-universalpython
13-
14- permissions :
15- id-token : write
1616
1717 steps :
1818 - uses : actions/checkout@v4
19-
19+ with :
20+ fetch-depth : 0
21+
2022 - name : Set up Python
2123 uses : actions/setup-python@v5
2224 with :
@@ -25,12 +27,19 @@ jobs:
2527 - name : Install dependencies
2628 run : |
2729 python -m pip install --upgrade pip
28- pip install build twine
30+ pip install build twine python-semantic-release
2931 pip install -r utils/requirements.txt
32+
33+ - name : Determine and tag prerelease version
34+ env :
35+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36+ run : |
37+ semantic-release version --prerelease --prerelease-token b --commit --tag --push
38+
3039 - name : Build package
3140 run : bash utils/build_package.sh
3241
33- - name : Publish to Test PyPI
42+ - name : Publish to TestPyPI
3443 uses : pypa/gh-action-pypi-publish@release/v1
3544 with :
36- repository-url : https://test.pypi.org/legacy/
45+ repository-url : https://test.pypi.org/legacy/
Original file line number Diff line number Diff line change @@ -46,15 +46,27 @@ universalpython = "universalpython.universalpython:main"
4646
4747[tool .semantic_release ]
4848version_toml = [" pyproject.toml:project.version" ]
49+ upload_to_pypi = false
50+ tag_format = " {version}"
4951build_command = " bash ./utils/build_package.sh"
5052commit_parser = " conventional"
5153major_on_zero = true
5254allow_zero_version = true
55+ prerelease_token = " b"
5356
5457[tool .semantic_release .commit_parser_options ]
5558parse_squash_commits = true
5659ignore_merge_commits = true
5760
5861[tool .semantic_release .changelog .default_templates ]
5962changelog_file = " ./CHANGELOG.md"
60- output_format = " md"
63+ output_format = " md"
64+
65+ [tool .semantic_release .branches .release ]
66+ match = " release"
67+ prerelease = false
68+
69+ [tool .semantic_release .branches .main ]
70+ match = " main"
71+ prerelease = true
72+ prerelease_token = " b"
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
2+ from importlib .metadata import version as get_version , PackageNotFoundError
3+
4+ try :
5+ __version__ = get_version ("universalpython" )
6+ except PackageNotFoundError :
7+ # When running locally before installation
8+ __version__ = "0.0.0"
9+
210"""
311UniversalPython.
412
You can’t perform that action at this time.
0 commit comments