@@ -11,15 +11,9 @@ concurrency:
1111 cancel-in-progress : false
1212
1313jobs :
14- publish-pypi-test :
15- name : Publish to TestPyPI
16- environment :
17- name : test
18- url : https://test.pypi.org/project/ultraplot/
14+ build-packages :
15+ name : Build packages
1916 runs-on : ubuntu-latest
20- permissions :
21- id-token : write
22- contents : read
2317 steps :
2418 - uses : actions/checkout@v4
2519 with :
3832 python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine
3933 python -m build --sdist --wheel . --outdir dist
4034
41- - name : CheckFiles
35+ - name : Check files
4236 run : |
4337 ls dist
4438 shell : bash
5953 popd
6054 shell : bash
6155
56+ - name : Upload artifacts
57+ uses : actions/upload-artifact@v4
58+ with :
59+ name : dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}
60+ path : dist/*
61+ if-no-files-found : error
62+
63+ publish-pypi-test :
64+ name : Publish to TestPyPI
65+ needs : build-packages
66+ if : github.event_name != 'pull_request'
67+ environment :
68+ name : test
69+ url : https://test.pypi.org/project/ultraplot/
70+ runs-on : ubuntu-latest
71+ permissions :
72+ id-token : write
73+ contents : read
74+ steps :
75+ - name : Download artifacts
76+ uses : actions/download-artifact@v4
77+ with :
78+ name : dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}
79+ path : dist
80+
81+ - name : Check files
82+ run : |
83+ ls dist
84+ shell : bash
85+
6286 - name : Publish to TestPyPI
63- if : github.event_name != 'pull_request'
6487 uses : pypa/gh-action-pypi-publish@release/v1
6588 with :
6689 repository-url : https://test.pypi.org/legacy/
6992 # we get a race condition if we don't skip existing
7093 skip-existing : ${{ github.event_name == 'release' && 'true' || 'false' }}
7194
72- publish-prod :
95+ publish-pypi :
7396 name : Publish to PyPI
7497 needs : publish-pypi-test
7598 environment :
@@ -81,44 +104,16 @@ jobs:
81104 id-token : write
82105 contents : read
83106 steps :
84- - uses : actions/checkout@v4
107+ - name : Download artifacts
108+ uses : actions/download-artifact@v4
85109 with :
86- fetch-depth : 0
110+ name : dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}
87111
88- - name : Get tags
89- run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
90- shell : bash
91-
92- - uses : actions/setup-python@v5
93- with :
94- python-version : " 3.12"
95-
96- - name : Build package
97- run : |
98- python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine
99- python -m build --sdist --wheel . --outdir dist
100-
101- - name : CheckFiles
112+ - name : Check files
102113 run : |
103114 ls dist
104115 shell : bash
105116
106- - name : Test wheels
107- run : |
108- pushd dist
109- python -m pip install ultraplot*.whl
110-
111- version=$(python -c "import ultraplot; print(ultraplot.__version__)")
112- echo "Version: $version"
113- if [[ "$version" == "0."* ]]; then
114- echo "Version is not set correctly!"
115- exit 1
116- fi
117-
118- python -m twine check *
119- popd
120- shell : bash
121-
122117 - name : Publish to PyPI
123118 uses : pypa/gh-action-pypi-publish@release/v1
124119 with :
0 commit comments