Skip to content

deploy

deploy #171

Workflow file for this run

name: deploy
on: workflow_dispatch
env:
POETRY_VER: 1.7.1
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Check out GitHub repository ${{ github.repository }}
uses: actions/checkout@v3
- name: Set up Python on ${{ runner.os }}
uses: actions/setup-python@v4
id: setup_python
with:
python-version: '3.10'
- name: Update pip
run: pip install --upgrade pip
- name: Install Poetry ${{ env.POETRY_VER }} on Python ${{ steps.setup_python.outputs.python-version }}
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VER }}
- name: Install dependencies on Python ${{ steps.setup_python.outputs.python-version }}
run: poetry install --with dev
- name: Check and fix with Ruff
run: |
poetry run ruff check ./openseries/*.py --fix --exit-non-zero-on-fix
poetry run ruff check ./tests/*.py --fix --exit-non-zero-on-fix
- name: Format with Black
run: poetry run black ./openseries/*.py ./tests/*.py
- name: Type check with Mypy
run: poetry run mypy .
- name: Tests with Pytest
run: poetry run coverage run -m pytest --verbose
- name: Report coverage
run: poetry run coverage report
- name: Create Git Tag with version from pyproject.toml
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
run: |
export GPG_TTY=$(tty)
echo "$GPG_PRIVATE_KEY" | gpg --batch --pinentry-mode loopback --import
version=$(poetry run python -c "import toml; print(toml.load('pyproject.toml')['tool']['poetry']['version'])")
echo "Version: $version"
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_EMAIL}"
git config --global user.signingkey 03BE0D766CA0CF9852B592D5BBE8A9CD2E275A01
git config --global gpg.program gpg
git tag -a "$version" -m "Release v$version"
git push origin "$version"
echo "tag_version=$version" >> "$GITHUB_ENV"
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.tag_version }}
- name: Build and Publish to Test PyPI
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }}
poetry build
poetry check
poetry publish --repository testpypi --skip-existing
- name: Build and Publish to PyPI
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry build
poetry check
poetry publish