File tree Expand file tree Collapse file tree 1 file changed +81
-0
lines changed
Expand file tree Collapse file tree 1 file changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-FileCopyrightText: 2026 The Botanu Authors
2+ # SPDX-License-Identifier: Apache-2.0
3+
4+ name : Publish to PyPI
5+
6+ on :
7+ release :
8+ types : [published]
9+ workflow_dispatch :
10+ inputs :
11+ target :
12+ description : ' Target repository'
13+ required : true
14+ default : ' testpypi'
15+ type : choice
16+ options :
17+ - testpypi
18+ - pypi
19+
20+ permissions :
21+ contents : read
22+
23+ jobs :
24+ build :
25+ runs-on : ubuntu-latest
26+ steps :
27+ - uses : actions/checkout@v4
28+ with :
29+ fetch-depth : 0
30+
31+ - uses : actions/setup-python@v5
32+ with :
33+ python-version : " 3.12"
34+
35+ - name : Install build dependencies
36+ run : pip install build
37+
38+ - name : Build package
39+ run : python -m build
40+
41+ - name : Upload artifacts
42+ uses : actions/upload-artifact@v4
43+ with :
44+ name : dist
45+ path : dist/
46+
47+ publish-testpypi :
48+ needs : build
49+ runs-on : ubuntu-latest
50+ if : github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'testpypi'
51+ environment : testpypi
52+ permissions :
53+ id-token : write
54+ steps :
55+ - name : Download artifacts
56+ uses : actions/download-artifact@v4
57+ with :
58+ name : dist
59+ path : dist/
60+
61+ - name : Publish to TestPyPI
62+ uses : pypa/gh-action-pypi-publish@release/v1
63+ with :
64+ repository-url : https://test.pypi.org/legacy/
65+
66+ publish-pypi :
67+ needs : build
68+ runs-on : ubuntu-latest
69+ if : github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'pypi')
70+ environment : pypi
71+ permissions :
72+ id-token : write
73+ steps :
74+ - name : Download artifacts
75+ uses : actions/download-artifact@v4
76+ with :
77+ name : dist
78+ path : dist/
79+
80+ - name : Publish to PyPI
81+ uses : pypa/gh-action-pypi-publish@release/v1
You can’t perform that action at this time.
0 commit comments