Skip to content

Release erroranalysis to PyPI #63

Release erroranalysis to PyPI

Release erroranalysis to PyPI #63

name: Release erroranalysis to PyPI
# trigger manually only ("collaborator" or more permissions required)
on:
workflow_dispatch:
inputs:
type:
description: "Test or Prod PyPI?"
required: true
default: "Test"
jobs:
release-error-analysis:
runs-on: ubuntu-latest
steps:
- name: fail if Test nor Prod
if: ${{ ! (github.event.inputs.type == 'Test' || github.event.inputs.type == 'Prod') }}
run: |
echo "Only Test or Prod can be used."
exit 1
# build wheel
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: update and upgrade pip, setuptools, wheel, and twine
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine
- name: install requirements.txt for erroranalysis
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
working-directory: erroranalysis
- name: pip freeze
run: pip freeze
- name: build wheel for erroranalysis
run: python setup.py sdist bdist_wheel
working-directory: erroranalysis
# run tests before publishing to PyPI
- name: install erroranalysis wheel locally
run: find ./dist/ -name '*.whl' -exec pip install {} \;
working-directory: erroranalysis
- name: run erroranalysis tests
run: pytest -s -v ./tests/
working-directory: erroranalysis
# publish to PyPI
- name: Publish erroranalysis package to Test PyPI
if: ${{ github.event.inputs.type == 'Test' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN_ERROR_ANALYSIS }}
repository_url: https://test.pypi.org/legacy/
packages_dir: erroranalysis/dist/
- name: Publish erroranalysis package to PyPI
if: ${{ github.event.inputs.type == 'Prod' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN_ERROR_ANALYSIS }}
packages_dir: erroranalysis/dist/