-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (35 loc) · 1.03 KB
/
publish_to_pypi.yaml
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
name: Publish Python Package to PyPI
on:
push:
tags:
- 'v*'
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Extract version from tag
id: get_version
run: echo "::set-output name=VERSION::${GITHUB_REF#refs/tags/v}"
shell: bash
- name: Echo the package version
run: |
echo "Package version: ${{ steps.get_version.outputs.VERSION }}"
# Assuming setup.py reads the version from a source that is updated to match the tag,
# or you're using a tool to sync them.
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Publish to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}