From 6928e3a7ea64f39cda8fc52bdf4685710da3d6e6 Mon Sep 17 00:00:00 2001 From: Filipp Ozinov Date: Mon, 9 Dec 2024 18:35:28 +0400 Subject: [PATCH] Deploy releases automatically --- .github/workflows/release.yaml | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..6479d81 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,41 @@ +name: Publish to PyPI + +on: + push: + tags: + - 'v*' # Trigger this workflow for tags starting with "v" + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 # Specify the Python version + + - name: Install Poetry + run: | + python -m pip install --upgrade pip + pip install poetry + + - name: Extract version from tag + id: get_version + run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - name: Update version in pyproject.toml + run: poetry version ${{ env.version }} + + - name: Install dependencies + run: poetry install --no-root + + - name: Build and Publish to PyPI + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} + run: | + poetry build + poetry publish