Skip to content

deism

deism #10

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-latest, windows-latest]
python-version: ['3.9', '3.10', '3.11']
permissions:
id-token: write # OIDC token required for authentication
contents: read
steps:
- name: Checkout the code
uses: actions/checkout@v3
# Set up Miniconda with specified version
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest" # Ensure Miniconda is installed
python-version: ${{ matrix.python-version }}
auto-activate-base: false # Avoid using the base environment
activate-environment: DEISM # Your Conda environment name
environment-file: deism_env.yml # Your environment.yml file to create the env
- name: Install dependencies
run: |
conda activate DEISM
conda env update --file environment.yml # Install dependencies from the environment file
- name: Build the package
run: |
conda activate DEISM
python -m build
- name: Test with pytest
run: |
conda activate DEISM
pytest
# Check the built package
- name: Check the package files
run: |
conda activate DEISM
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: |
conda activate DEISM
rm -rf dist build *.egg-info