-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (40 loc) · 1.15 KB
/
publish.yml
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
name: Publish to PyPI
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
# Install dependencies for building and publishing
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
# Extract version from setup.py
- name: Extract version from setup.py
id: extract_version
run: |
version=$(python setup.py --version)
echo "VERSION=$version" >> $GITHUB_ENV
# Log the extracted version
- name: Show extracted version
run: echo "Extracted Version: ${{ env.VERSION }}"
# Build the package
- name: Build the package
run: python -m build
# Publish to PyPI
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*