File tree 1 file changed +67
-0
lines changed
1 file changed +67
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ name : Build & maybe upload PyPI package
3
+
4
+ on :
5
+ push :
6
+ branches : [main]
7
+ tags : ["*"]
8
+ pull_request :
9
+ branches : [main]
10
+ release :
11
+ types :
12
+ - published
13
+ workflow_dispatch :
14
+
15
+ permissions :
16
+ contents : read
17
+ id-token : write
18
+
19
+ jobs :
20
+ # Always build & lint package.
21
+ build-package :
22
+ name : Build & verify package
23
+ runs-on : ubuntu-latest
24
+
25
+ steps :
26
+ - uses : actions/checkout@v3
27
+ with :
28
+ fetch-depth : 0
29
+
30
+ - uses : hynek/build-and-inspect-python-package@v1
31
+
32
+ # Upload to Test PyPI on every commit on main.
33
+ release-test-pypi :
34
+ name : Publish in-dev package to test.pypi.org
35
+ if : github.repository_owner == 'python' && github.event_name == 'push' && github.ref == 'refs/heads/main'
36
+ runs-on : ubuntu-latest
37
+ needs : build-package
38
+
39
+ steps :
40
+ - name : Download packages built by build-and-inspect-python-package
41
+ uses : actions/download-artifact@v3
42
+ with :
43
+ name : Packages
44
+ path : dist
45
+
46
+ - name : Upload package to Test PyPI
47
+ uses : pypa/gh-action-pypi-publish@release/v1
48
+ with :
49
+ repository-url : https://test.pypi.org/legacy/
50
+
51
+ # Upload to real PyPI on GitHub Releases.
52
+ release-pypi :
53
+ name : Publish released package to pypi.org
54
+ environment : release-pypi
55
+ if : github.repository_owner == 'python' && github.event.action == 'published'
56
+ runs-on : ubuntu-latest
57
+ needs : build-package
58
+
59
+ steps :
60
+ - name : Download packages built by build-and-inspect-python-package
61
+ uses : actions/download-artifact@v3
62
+ with :
63
+ name : Packages
64
+ path : dist
65
+
66
+ - name : Upload package to PyPI
67
+ uses : pypa/gh-action-pypi-publish@release/v1
You can’t perform that action at this time.
0 commit comments