Skip to content

deploy

deploy #181

Workflow file for this run

name: deploy
on: workflow_dispatch
jobs:
deploy:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Check out GitHub repository ${{ github.repository }}
uses: actions/checkout@v4
- name: Install Poetry
run: |
pip install --user pipx
pipx ensurepath
pipx install poetry==1.8.3
- name: Set up Python on ${{ runner.os }}
uses: actions/setup-python@v5
id: setup_python
with:
python-version: '3.10'
cache: 'poetry'
- 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 ./tests/*.py ./openseries/*.py --fix --exit-non-zero-on-fix
- name: Type check with Mypy
run: poetry run mypy .
- name: Tests with Pytest
run: PYTHONPATH=${PWD} 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=$(grep -oP '(?<=version = ").*(?=")' pyproject.toml)
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@v2
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