86
86
87
87
cd :
88
88
needs : ci
89
- if : github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master')
89
+ # Note: github.event.pull_request.draft == false WON'T WORK in "if" statement,
90
+ # because the triggered event is a push, not a pull_request.
91
+ # This means each commit will trigger a release on TestPyPI.
92
+ # Those releases will only succeed when each push has a new version number: a1, a2, a3, etc.
93
+ if : |
94
+ github.event_name == 'push' &&
95
+ (
96
+ startsWith(github.ref, 'refs/tags') ||
97
+ startsWith(github.ref, 'refs/heads/release-')
98
+ )
90
99
runs-on : ubuntu-latest
91
100
steps :
92
101
- uses : actions/checkout@v4
@@ -98,14 +107,16 @@ jobs:
98
107
run : |
99
108
python -m pip install build --user
100
109
python -m build --sdist --wheel --outdir dist/ .
101
- - name : Publish to TestPyPI
110
+ - name : |
111
+ Publish to TestPyPI when pushing to release-* branch.
112
+ You better test with a1, a2, b1, b2 releases first.
102
113
103
- if : github.ref == 'refs/heads/master'
114
+ if: startsWith( github.ref, 'refs/heads/release-')
104
115
with:
105
116
user: __token__
106
117
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
107
118
repository_url: https://test.pypi.org/legacy/
108
- - name : Publish to PyPI
119
+ - name : Publish to PyPI when tagged
109
120
if : startsWith(github.ref, 'refs/tags')
110
121
111
122
with :
0 commit comments