Skip to content

Commit

Permalink
create workflows publish-to-pypi.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
JianboHIT committed Jun 24, 2024
1 parent 77092b4 commit 6e4ac26
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Python package to PyPI - JianboHIT

on:
push:
tags:
- 'v*'

jobs:
build-and-publish:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Install build and twine
run: |
python -m pip install --upgrade pip
pip install setuptools build twine
- name: Install package dependencies
run: |
pip install -e .[full]
- name: Run tests
run: |
python3 -m unittest discover -s tests -v
- name: Build package
run: |
python -m build
- name: Check package with twine
run: |
twine check dist/*
- name: Publish to PyPI
if: success()
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.JIANBOHIT_PYPI_API_TOKEN }}
repository-url: https://upload.pypi.org/legacy/

0 comments on commit 6e4ac26

Please sign in to comment.