Skip to content

deism

deism #12

Workflow file for this run

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: deism
on:
release:
types: [published]
jobs:
build-and-publish:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, macos-latest, windows-2019]
python-version: ['3.9', '3.10', '3.11']
exclude:
- os: macos-latest
python-version: 3.9
permissions:
id-token: write # OIDC token required for authentication
contents: read
steps:
- name: Checkout the code
uses: actions/checkout@v3
# Step 2: Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Step 3: Install dependencies using pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip # Ensure pip is up-to-date
pip install -r requirements.txt # Install dependencies from requirements.txt
python -m pip install pybind11
- name: Build package
run: |
python -m pip install -e .
- name: Test with pytest
run: |
pip install -U pytest setuptools build wheel twine
pytest
# Check the built package
- name: Check the package files
run: |
twine check dist/* # Check the integrity of the package
# Publish to PyPI (using OIDC and trusted publisher setup)
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://upload.pypi.org/legacy/ # The repository URL for PyPI
env:
TWINE_USERNAME: __token__ # OIDC-based authentication
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} # Fallback in case OIDC is not available
- name: Clean up build artifacts
run: |
rm -rf dist build *.egg-info