File tree 2 files changed +48
-14
lines changed
2 files changed +48
-14
lines changed Original file line number Diff line number Diff line change @@ -2,31 +2,66 @@ name: Upload Package to PyPI
2
2
3
3
on :
4
4
release :
5
- types : [created]
5
+ types :
6
+ - published
6
7
7
8
jobs :
8
- deploy :
9
+ build-artifacts :
9
10
runs-on : ubuntu-latest
10
11
if : github.repository == 'xarray-contrib/pint-xarray'
11
12
steps :
12
13
- uses : actions/checkout@v4
13
- - name : Set up Python
14
- uses : actions/setup-python@v5
15
14
with :
16
- python-version : ' 3.x'
15
+ fetch-depth : 0
16
+
17
+ - uses : actions/setup-python@v5
18
+ name : Install Python
19
+ with :
20
+ python-version : " 3.x"
21
+
17
22
- name : Install dependencies
18
23
run : |
19
24
python -m pip install --upgrade pip
20
25
python -m pip install build twine
21
- - name : Build
26
+
27
+ - name : Build tarball and wheels
22
28
run : |
23
- python -m build --sdist --wheel --outdir dist/ .
24
- - name : Check the built archives
29
+ git clean -xdf
30
+ git restore -SW .
31
+ python -m build --outdir dist/ .
32
+
33
+ - name : Check built artifacts
25
34
run : |
26
- twine check dist/*
27
- - name : Publish to PyPI
35
+ python -m twine check --strict dist/*
36
+ pwd
37
+ if [ -f dist/pint-xarray-0.0.0.tar.gz ]; then
38
+ echo "❌ INVALID VERSION NUMBER"
39
+ exit 1
40
+ else
41
+ echo "✅ Looks good"
42
+ fi
43
+ - uses : actions/upload-artifact@v4
44
+ with :
45
+ name : releases
46
+ path : dist
47
+
48
+ upload-to-pypi :
49
+ needs : build-artifacts
50
+ if : github.event_name == 'release'
51
+ runs-on : ubuntu-latest
52
+
53
+ environment :
54
+ name : pypi
55
+ url : https://pypi.org/p/pint-xarray
56
+ permissions :
57
+ id-token : write
58
+
59
+ steps :
60
+ - uses : actions/download-artifact@v4
61
+ with :
62
+ name : releases
63
+ path : dist
64
+ - name : Publish package to PyPI
28
65
uses : pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450
29
66
with :
30
- user : __token__
31
- password : ${{ secrets.pypi_password }}
32
- repository_url : https://upload.pypi.org/legacy/
67
+ verbose : true
Original file line number Diff line number Diff line change 19
19
- repo : https://github.com/psf/black
20
20
rev : 24.4.2
21
21
hooks :
22
- - id : black
23
22
- id : black-jupyter
24
23
- repo : https://github.com/keewis/blackdoc
25
24
rev : v0.3.9
You can’t perform that action at this time.
0 commit comments