-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (36 loc) · 1.31 KB
/
python-publish.yml
File metadata and controls
45 lines (36 loc) · 1.31 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
# This workflow will upload a Python Package 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: Publish Python Package
on:
release:
types: [published]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# 1. Checkout the repository with full history and tags
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history so that tags are available
# 2. Set up Python
- name: Set up Python
uses: actions/setup-python@v4 # Updated to v4 for the latest features
with:
python-version: '3.x' # Specify your Python version
# 3. Install dependencies including setuptools_scm and build tools
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel setuptools_scm build twine
# 4. Build the package
- name: Build package
run: python -m build
# 5. Publish the package to PyPI
- name: Publish package
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}