Merge pull request #6 from small-thinking/add-basic #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |