mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-11 18:46:55 +08:00
88 lines
4.5 KiB
YAML
88 lines
4.5 KiB
YAML
# ==================================================================================================================== #
|
|
# Authors: #
|
|
# Patrick Lehmann #
|
|
# Unai Martinez-Corral #
|
|
# #
|
|
# ==================================================================================================================== #
|
|
# Copyright 2020-2026 The pyTooling Authors #
|
|
# #
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); #
|
|
# you may not use this file except in compliance with the License. #
|
|
# You may obtain a copy of the License at #
|
|
# #
|
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
|
# #
|
|
# Unless required by applicable law or agreed to in writing, software #
|
|
# distributed under the License is distributed on an "AS IS" BASIS, #
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
|
# See the License for the specific language governing permissions and #
|
|
# limitations under the License. #
|
|
# #
|
|
# SPDX-License-Identifier: Apache-2.0 #
|
|
# ==================================================================================================================== #
|
|
name: Publish on PyPI
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
ubuntu_image_version:
|
|
description: 'Ubuntu image version.'
|
|
required: false
|
|
default: '24.04'
|
|
type: string
|
|
python_version:
|
|
description: 'Python version.'
|
|
required: false
|
|
default: '3.14'
|
|
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-${{ inputs.ubuntu_image_version }}"
|
|
|
|
steps:
|
|
- name: 📥 Download artifacts '${{ inputs.artifact }}' from 'Package' job
|
|
uses: pyTooling/download-artifact@v7
|
|
with:
|
|
name: ${{ inputs.artifact }}
|
|
path: dist
|
|
|
|
- name: 🐍 Setup Python ${{ inputs.python_version }}
|
|
uses: actions/setup-python@v6
|
|
with:
|
|
python-version: ${{ inputs.python_version }}
|
|
|
|
- name: ⚙ Install dependencies for packaging and release
|
|
run: python -m pip install --disable-pip-version-check ${{ inputs.requirements }}
|
|
|
|
- name: ⤴ Publish Python wheel package to PyPI
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
run: twine upload dist/*.whl
|
|
|
|
- name: ⤴ Publish Python source package to PyPI
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
run: twine upload dist/*.tar.gz
|
|
|
|
- name: 🗑️ Delete packaging Artifacts
|
|
uses: geekyeggo/delete-artifact@v5
|
|
with:
|
|
name: ${{ inputs.artifact }}
|