1
+ name : Build and upload to PyPI
2
+
3
+ on :
4
+ release :
5
+ types :
6
+ - published
7
+
8
+ jobs :
9
+
10
+ build-artifacts :
11
+
12
+ runs-on : ubuntu-latest
13
+
14
+ steps :
15
+
16
+ - name : Checkout
17
+ uses : actions/checkout@v3
18
+ with :
19
+ fetch-depth : 0
20
+
21
+ - name : Install Python
22
+ uses : actions/setup-python@v4
23
+ with :
24
+ python-version : " 3.11"
25
+
26
+ - name : Install PyPi dependencies
27
+ run : |
28
+ python -m pip install --upgrade pip
29
+ python -m pip install build twine
30
+
31
+ - name : Build tarball and wheels
32
+ run : |
33
+ git clean -xdf
34
+ git restore -SW .
35
+ python -m build
36
+
37
+ - name : Upload artifact
38
+ uses : actions/upload-artifact@v3
39
+ with :
40
+ name : releases
41
+ path : dist
42
+
43
+ publish_pypi_test :
44
+
45
+ needs : build-artifacts
46
+ runs-on : ubuntu-latest
47
+ environment :
48
+ name : release
49
+ url : https://test.pypi.org/project/acs-axiom
50
+ permissions :
51
+ id-token : write
52
+
53
+ steps :
54
+
55
+ - name : Install Python
56
+ uses : actions/setup-python@v4
57
+ with :
58
+ python-version : " 3.11"
59
+
60
+ - name : Download artifact
61
+ uses : actions/download-artifact@v3
62
+ with :
63
+ name : releases
64
+ path : dist
65
+
66
+ - name : Install PyPi dependencies
67
+ run : |
68
+ python -m pip install --upgrade pip
69
+ python -m pip install build twine
70
+
71
+ - name : Check build artifacts
72
+ run : |
73
+ python -m twine check dist/*
74
+ pwd
75
+ if [ -f dist/axiom-0.0.0.tar.gz ]; then
76
+ echo "INVALID VERSION NUMBER"
77
+ exit 1
78
+ fi
79
+
80
+ - name : Publish package distributions to TestPyPI
81
+ uses : pypa/gh-action-pypi-publish@release/v1
82
+ with :
83
+ repository-url : https://test.pypi.org/legacy/
84
+
85
+ publish_pypi_prod :
86
+
87
+ needs : publish_pypi_test
88
+ runs-on : ubuntu-latest
89
+ environment :
90
+ name : release
91
+ url : https://pypi.org/project/acs-axiom
92
+ permissions :
93
+ id-token : write
94
+
95
+ steps :
96
+
97
+ - name : Install Python
98
+ uses : actions/setup-python@v4
99
+ with :
100
+ python-version : " 3.11"
101
+
102
+ - name : Download artifact
103
+ uses : actions/download-artifact@v3
104
+ with :
105
+ name : releases
106
+ path : dist
107
+
108
+ - name : Install PyPi dependencies
109
+ run : |
110
+ python -m pip install --upgrade pip
111
+ python -m pip install build twine
112
+
113
+ - name : Check build artifacts
114
+ run : |
115
+ python -m twine check dist/*
116
+ pwd
117
+ if [ -f dist/axiom-0.0.0.tar.gz ]; then
118
+ echo "INVALID VERSION NUMBER"
119
+ exit 1
120
+ fi
121
+
122
+ - name : Publish package distributions to TestPyPI
123
+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments