mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
add reusable workflows
This commit is contained in:
53
.github/workflows/PublishOnPyPI.yml
vendored
Normal file
53
.github/workflows/PublishOnPyPI.yml
vendored
Normal 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 }}
|
||||
Reference in New Issue
Block a user