mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 11:06:56 +08:00
64 lines
1.7 KiB
YAML
64 lines
1.7 KiB
YAML
name: Publish on PyPI
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
python_version:
|
|
description: 'Python version.'
|
|
required: false
|
|
default: '3.10'
|
|
type: string
|
|
requirements:
|
|
description: 'Python dependencies to be installed through pip.'
|
|
required: false
|
|
default: 'wheel twine'
|
|
type: string
|
|
artifact:
|
|
description: 'Name of the package artifact.'
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
PYPI_TOKEN:
|
|
description: "Token for pushing releases to PyPI"
|
|
required: false
|
|
|
|
jobs:
|
|
|
|
PublishOnPyPI:
|
|
name: 🚀 Publish to PyPI
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: 📥 Download artifacts '${{ inputs.artifact }}' from 'Package' job
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ inputs.artifact }}
|
|
path: dist/
|
|
|
|
- name: 🐍 Setup Python ${{ inputs.python_version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ inputs.python_version }}
|
|
|
|
- name: ⚙ Install dependencies for packaging and release
|
|
run: |
|
|
python -m pip install -U pip
|
|
python -m pip install ${{ inputs.requirements }}
|
|
|
|
- name: ⤴ Release Python source package to PyPI
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
run: twine upload dist/*.tar.gz
|
|
|
|
- name: ⤴ Release Python wheel package to PyPI
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
run: twine upload dist/*.whl
|
|
|
|
- name: 🗑️ Delete packaging Artifacts
|
|
uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: ${{ inputs.artifact }}
|