35
35
# - main
36
36
37
37
jobs :
38
- publish-pypi :
39
- name : Publish to PyPI
38
+ build :
39
+ name : Build distribution 📦
40
40
runs-on : ubuntu-latest
41
- permissions :
42
- # This permission is mandatory for OIDC publishing
43
- id-token : write
44
- if : github.repository == 'GenericMappingTools/pygmt'
45
41
46
42
steps :
47
43
- name : Checkout
48
44
49
45
with :
50
46
# fetch all history so that setuptools-scm works
51
47
fetch-depth : 0
48
+ persist-credentials : false
52
49
53
50
- name : Set up Python
54
51
@@ -74,11 +71,54 @@ jobs:
74
71
echo "Generated files:"
75
72
ls -lh dist/
76
73
77
- - name : Publish to Test PyPI
74
+ - name : Store the distribution packages
75
+
76
+ with :
77
+ name : python-package-distributions
78
+ path : dist/
79
+
80
+ publish-to-testpypi :
81
+ name : Publish Python 🐍 distribution 📦 to TestPyPI
82
+ if : github.repository == 'GenericMappingTools/pygmt'
83
+ needs :
84
+ - build
85
+ runs-on : ubuntu-latest
86
+ environment :
87
+ name : testpypi
88
+ url : https://test.pypi.org/project/pygmt
89
+ permissions :
90
+ id-token : write # IMPORTANT: mandatory for trusted OIDC publishing
91
+
92
+ steps :
93
+ - name : Download all the dists
94
+
95
+ with :
96
+ name : python-package-distributions
97
+ path : dist/
98
+
99
+ - name : Publish distribution 📦 to TestPyPI
78
100
79
101
with :
80
102
repository-url : https://test.pypi.org/legacy/
81
103
82
- - name : Publish to PyPI
83
- if : startsWith(github.ref, 'refs/tags')
104
+ publish-pypi :
105
+ name : Publish Python 🐍 distribution 📦 to PyPI
106
+ if : github.repository == 'GenericMappingTools/pygmt' && startsWith(github.ref, 'refs/tags/')
107
+ needs :
108
+ - build
109
+ runs-on : ubuntu-latest
110
+ environment :
111
+ name : pypi
112
+ url : https://pypi.org/project/pygmt/
113
+ permissions :
114
+ id-token : write # IMPORTANT: mandatory for trusted OIDC publishing
115
+
116
+ steps :
117
+ - name : Download all the dists
118
+
119
+ with :
120
+ name : python-package-distributions
121
+ path : dist/
122
+
123
+ - name : Publish distribution 📦 to PyPI
84
124
0 commit comments