From 8c3402dd222d2773770bf0de8e68d85931efdf84 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Wed, 20 Nov 2024 20:34:29 +0100 Subject: [PATCH] Update `publish.yaml` with latest PyPI recommendations (#2516) * Update `publish.yaml` with latest PyPI recommendations * Update .github/workflows/publish.yml * Simplify pipeline * Simplify pipeline * Use Python 3.12 --- .github/workflows/publish.yml | 88 ++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7ecef5559..c97c1acac 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,24 +6,80 @@ on: - '*' jobs: - publish: - name: "Publish release" - runs-on: "ubuntu-latest" + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: scripts/install + + - name: Build package & docs + run: scripts/build + + - name: Upload package distributions + uses: actions/upload-artifact@v2 + with: + name: package-distributions + path: dist/ + + - name: Upload documentation + uses: actions/upload-artifact@v2 + with: + name: documentation + path: site/ + + pypi-publish: + runs-on: ubuntu-latest + needs: build + + permissions: + id-token: write environment: - name: deploy + name: pypi + url: https://pypi.org/project/uvicorn steps: - - uses: "actions/checkout@v4" - - uses: "actions/setup-python@v5" + - name: Download artifacts + uses: actions/download-artifact@v2 with: - python-version: "3.8" - - name: "Install dependencies" - run: "scripts/install" - - name: "Build package & docs" - run: "scripts/build" - - name: "Publish to PyPI & deploy docs" - run: "scripts/publish" - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + name: package-distributions + path: dist/ + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + docs-publish: + runs-on: ubuntu-latest + needs: build + + permissions: + contents: write + + steps: + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: documentation + path: site/ + + - name: Configure Git Credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: scripts/install + + - name: Publish documentation 📚 to GitHub Pages + run: mkdocs gh-deploy --force