-
Notifications
You must be signed in to change notification settings - Fork 15
36 lines (34 loc) · 1.15 KB
/
pipy_release.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
name: Publish Python 🐍 distributions 📦 to PyPI
on:
push:
tags:
- '*' # Trigger on any tagging event
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3 # Updated to a specific version of the checkout action
with:
ref: main # Ensure it checks out the main branch
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: Install setuptools and wheel
run: python -m pip install setuptools wheel
- name: Extract tag name
id: tag
run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Extract version from __init__.py
id: get_version
run: |
VERSION=$(grep '__version__' your_package/__init__.py | cut -d'"' -f2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build a binary wheel
run: >-
python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}