-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (52 loc) · 1.8 KB
/
python-publish.yml
File metadata and controls
63 lines (52 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Publish to PyPI and TestPyPI
on:
push:
paths:
- 'CHANGELOG.txt' # Only run when CHANGELOG.txt changes
release:
types: [published] # Run when a GitHub Release is published
jobs:
build-and-publish-testpypi:
if: github.event_name == 'push'
name: Build and publish to TestPyPI (on setup.py change)
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11.9
uses: actions/setup-python@v4
with:
python-version: '3.11.9'
- name: Install build tool
run: python -m pip install --upgrade pip build
- name: Build sdist and wheel
run: python -m build --sdist --wheel --outdir dist/ .
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
user: __token__
verbose: 'true'
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
skip-existing: true
build-and-publish-pypi:
if: github.event_name == 'release' && github.event.action == 'published'
name: Build and publish to PyPI (on Release)
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11.9
uses: actions/setup-python@v4
with:
python-version: '3.11.9'
- name: Install build tool
run: python -m pip install --upgrade pip build
- name: Build sdist and wheel
run: python -m build --sdist --wheel --outdir dist/ .
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository-url: https://upload.pypi.org/legacy/
skip-existing: true
verbose: true