Skip to content

feat: Starfile export #8

feat: Starfile export

feat: Starfile export #8

Workflow file for this run

name: Publish Python Package
on:
push:
branches:
- main
- release
- release-test
tags:
- "v*"
pull_request:
workflow_dispatch:
# cancel in-progress runs that use the same workflow and branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: ${{ matrix.platform }} (${{ matrix.python-version }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
platform: [ubuntu-latest, ] # macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache-dependency-path: "pyproject.toml"
cache: "pip"
- name: Install Dependencies
run: |
python -m pip install -U pip
# python -m pip install .[test]
# - name: 🧪 Run Tests
# run: pytest --color=yes --cov --cov-report=xml --cov-report=term-missing
- name: Coverage
uses: codecov/codecov-action@v5
build-and-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
needs: test # Only run after tests pass
runs-on: ubuntu-latest
# Only publish on tag pushes
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Build with Poetry
run: poetry build
- name: Validate wheel with twine
run: |
pip install --upgrade twine
twine check dist/*
# Always publish to TestPyPI for any version tag
- name: Publish to TestPyPI
if: startsWith(github.ref, 'refs/tags/v')
run: |
python -m pip install --upgrade twine
twine upload --repository-url https://test.pypi.org/legacy/ dist/* --verbose
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
# Only publish to PyPI for release versions (no -test, -rc, etc.)
- name: Publish to PyPI
if: |
startsWith(github.ref, 'refs/tags/v') &&
!contains(github.ref, '-test') &&
!contains(github.ref, '-beta') &&
!contains(github.ref, '-alpha') &&
!contains(github.ref, '-dev')
run: |
python -m pip install --upgrade twine
twine upload dist/* --verbose
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}