-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (42 loc) · 1.46 KB
/
python-publish.yml
File metadata and controls
53 lines (42 loc) · 1.46 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
# .github/workflows/python-publish.yml
# This workflow will upload a Python Package to PyPI using Twine when a release is created.
# For more information, see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read
packages: write # Needed for uploading to PyPI
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code from the repository
- name: Checkout Code
uses: actions/checkout@v4
# Step 2: Set up Python version
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
# Step 3: Install dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel twine
pip install -r requirements.txt
# Step 4: Build the package
- name: Build Package
run: |
python setup.py sdist bdist_wheel
# Step 5: Publish the package to PyPI
- name: Publish Package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*
# Optional Step: Verify the uploaded package
- name: Verify PyPI Upload (Optional)
run: |
pip install labmateai --index-url https://upload.pypi.org/legacy/