From 71e7e62e36b4487399c17386eafac5fb3c8b78ce Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Mon, 17 Jul 2023 22:57:31 +0300 Subject: [PATCH] Update publish pipeline --- .github/workflows/pypi-release.yml | 33 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml index 1cfe82b1..c78a89ac 100644 --- a/.github/workflows/pypi-release.yml +++ b/.github/workflows/pypi-release.yml @@ -12,13 +12,20 @@ jobs: steps: - uses: actions/checkout@master - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - name: Install build dependencies - run: python -m pip install --upgrade build + run: python -m pip install --upgrade build hatch + + - name: Resolve version + id: package-version + run: echo "value=$(echo ${{ github.ref }} | sed -e 's/refs\/tags\/v//')" >> $GITHUB_OUTPUT + + - name: Bump version + run: hatch version ${{ steps.package-version.outputs.value }} - name: Build source distribution run: python -m build . @@ -40,8 +47,12 @@ jobs: publish: name: Publish needs: build - if: "success() && startsWith(github.ref, 'refs/tags/')" runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/aiogram/${{ steps.package-version.outputs.value }}/ + permissions: + id-token: write steps: - name: Download artifacts uses: actions/download-artifact@v1 @@ -49,17 +60,5 @@ jobs: name: dist path: dist - # - name: Publish a Python distribution to Test PyPI - # uses: pypa/gh-action-pypi-publish@master - ## if: github.event.action != 'published' - # with: - # user: __token__ - # password: ${{ secrets.PYPI_TEST_TOKEN }} - # repository_url: https://test.pypi.org/legacy/ - - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@master - # if: github.event.action == 'published' - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} + uses: pypa/gh-action-pypi-publish@release/v1