@@ -82,12 +82,40 @@ jobs:
82
82
name : wheels
83
83
path : bindings/python/dist
84
84
85
- publish :
86
- name : Publish Python 🐍 distribution 📦
85
+ pypi- publish :
86
+ name : Publish Python 🐍 distribution 📦 to Pypi
87
87
needs : [ sdist, linux ]
88
88
runs-on : ubuntu-latest
89
- # Only publish if it's a tag
90
- if : " startsWith(github.ref, 'refs/tags/')"
89
+ # Only publish to PyPi if the tag is not a pre-release
90
+ if : ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-') }}
91
+
92
+ environment :
93
+ name : pypi
94
+ url : https://pypi.org/p/pyiceberg_core
95
+
96
+ permissions :
97
+ id-token : write # IMPORTANT: mandatory for trusted publishing
98
+
99
+ steps :
100
+ - name : Download all the dists
101
+ uses : actions/download-artifact@v3
102
+ with :
103
+ name : wheels
104
+ path : bindings/python/dist
105
+ - name : Publish to PyPI
106
+ uses : pypa/gh-action-pypi-publish@release/v1
107
+
108
+ with :
109
+ skip-existing : true
110
+ packages-dir : bindings/python/dist
111
+
112
+ testpypi-publish :
113
+ name : Publish Python 🐍 distribution 📦 to TestPypi
114
+ needs : [ sdist, linux ]
115
+ runs-on : ubuntu-latest
116
+ # Only publish to TestPyPi if the tag is a pre-release
117
+ if : ${{ startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-')}}
118
+
91
119
environment :
92
120
name : testpypi
93
121
url : https://test.pypi.org/p/pyiceberg_core
@@ -102,17 +130,8 @@ jobs:
102
130
name : wheels
103
131
path : bindings/python/dist
104
132
- name : Publish to TestPyPI
105
- # Only publish to TestPyPi if the tag is a pre-release
106
- if : " contains(github.ref, '-')"
107
133
uses : pypa/gh-action-pypi-publish@release/v1
108
134
with :
109
135
repository-url : https://test.pypi.org/legacy/
110
136
skip-existing : true
111
137
packages-dir : bindings/python/dist
112
- - name : Publish to PyPI
113
- uses : pypa/gh-action-pypi-publish@release/v1
114
- # Only publish to PyPi if the tag is not a pre-release
115
- if : " !contains(github.ref, '-')"
116
- with :
117
- skip-existing : true
118
- packages-dir : bindings/python/dist
0 commit comments