add reusable workflows

This commit is contained in:
umarcor
2021-11-22 02:07:12 +01:00
parent 7647c96c79
commit 35738eef8f
11 changed files with 633 additions and 0 deletions

53
.github/workflows/PublishOnPyPI.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: Publish on PyPI
on:
workflow_call:
inputs:
pyver:
description: 'Python version.'
required: false
default: '3.10'
type: string
artifact:
description: 'Name of the wheel 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.pyver }}
uses: actions/setup-python@v2
with:
python-version: ${{ inputs.pyver }}
- name: ⚙ Install dependencies for packaging and release
run: |
python -m pip install --upgrade pip
pip install wheel twine
- name: ⤴ Release Python package to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload dist/*
- name: 🗑️ Delete packaging Artifacts
uses: geekyeggo/delete-artifact@v1
with:
name: ${{ inputs.artifact }}