Skip to content

Publish to TestPyPI

Publish to TestPyPI #1

Workflow file for this run

name: Publish to TestPyPI
on:
workflow_dispatch:
inputs:
tag:
description: 'Git Tag (Release) to validate and upload'
required: true
type: string
jobs:
validate-release:
name: Validate Release Across Python Versions
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('ci/requirements.txt') }}-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: Update pip and install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade wheel
pip install -r ci/requirements.txt
pip install .
- name: Run tests
run: pytest tests --cov solt --cov-report term-missing -v
- name: Run black
run: black --config=black.toml --check .
- name: Run flake8
run: flake8
build-and-publish:
name: Build and Publish to TestPyPI
runs-on: ubuntu-latest
needs: validate-release
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build package
run: python -m build
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API }}
packages-dir: dist/