Skip to content

Обновил workflow для создания релиза #22

Обновил workflow для создания релиза

Обновил workflow для создания релиза #22

Workflow file for this run

name: Publish Python Package
on:
push:
branches:
- main
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 "IS_PRERELEASE=true" >> $GITHUB_ENV
else
echo "IS_PRERELEASE=false" >> $GITHUB_ENV
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_EXISTS=true" >> $GITHUB_ENV
else
echo "VERSION_EXISTS=false" >> $GITHUB_ENV
fi
- name: Publish to PyPI
if: env.IS_PRERELEASE == 'false' && env.VERSION_EXISTS == 'false'
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $POETRY_PYPI_TOKEN_PYPI
poetry build
poetry publish