Фикс тригонометрической окружности #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Python Package | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'pyproject.toml' | |
jobs: | |
check_version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
- name: Get current version | |
id: get_version | |
run: | | |
echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV | |
- name: Check if version is pre-release | |
id: check_prerelease | |
run: | | |
if [[ "${{ env.VERSION }}" == *"alpha"* || "${{ env.VERSION }}" == *"beta"* ]]; then | |
echo "Pre-release version ${{ env.VERSION }} detected. Skipping publish." | |
exit 0 | |
fi | |
- name: Check if version exists on PyPI | |
id: check_version | |
run: | | |
if curl -s https://pypi.org/pypi/manimextra/json | jq -e ".releases | has(\"${{ env.VERSION }}\")"; then | |
echo "Version ${{ env.VERSION }} already exists on PyPI. Failing the workflow." | |
exit 1 | |
fi | |
- name: Publish to PyPI | |
if: steps.check_prerelease.outcome != 'success' && steps.check_version.outcome != 'failure' | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
poetry config pypi-token.pypi $POETRY_PYPI_TOKEN_PYPI | |
poetry publish --build --no-interaction |