Skip to content

Python Package

Python Package #1

Workflow file for this run

name: Python Package
on:
workflow_dispatch:
inputs:
push:
description: Push the image to the registry
default: false
type: boolean
tag:
description: Tag to push
required: true
type: string
workflow_call:
inputs:
push:
description: Push the image to the registry
default: true
type: boolean
tag:
description: Tag to push
required: true
type: string
secrets:
PYPI_API_TOKEN:
description: PyPi token
required: true
jobs:
package:
name: Package
runs-on: ubuntu-latest
steps:
# checkout code
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}
# install python
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
# install the project
- name: Install Dependencies
run: |
pip install .[build]
pip install .
- name: Run the Build
run: |
version=$(python -m setuptools_scm)
echo "Building Version: $version"
python -m build
- name: Publish Package to PyPI
if: inputs.push == true
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}