-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (33 loc) · 1.03 KB
/
pypi_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
name: Upload Python Package
on:
# Trigger on release creation
release:
types: [created]
# Allow manual triggering for testing
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository code
- name: Check out code
uses: actions/checkout@v2
# Step 2: Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9' # Use a specific Python version for consistency
# Step 3: Upgrade pip and install dependencies for building and publishing
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
# Step 4: Build the package
- name: Build the package
run: python -m build
# Step 5: Publish to PyPI
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} # PyPI username or __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} # PyPI password or API token
run: twine upload dist/*