From d63bcd506b71e0771c9302b9c2c91b90c1ec6374 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Mon, 12 Aug 2024 10:48:53 +0000 Subject: [PATCH] ci: update manual publish to pypi workflow (#570) --- .github/workflows/ci.yml | 2 +- .github/workflows/manual_pypi_publish.yml | 100 +++++++++++++++++++--- 2 files changed, 87 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad84c200..32213326 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: - name: Set up Poetry uses: abatilo/actions-poetry@v3 with: - poetry-version: 1.3.2 + poetry-version: 1.8.3 - name: Run Tests run: make run_tests - name: Upload Coverage diff --git a/.github/workflows/manual_pypi_publish.yml b/.github/workflows/manual_pypi_publish.yml index 4b165b3f..46690629 100644 --- a/.github/workflows/manual_pypi_publish.yml +++ b/.github/workflows/manual_pypi_publish.yml @@ -1,30 +1,102 @@ name: Manual PyPi Publish on: workflow_dispatch: - inputs: - username: - description: PyPi Username - required: true - default: __token__ - password: - description: PyPi Password - required: true + jobs: + test: + name: Test / OS ${{ matrix.os }} / Python ${{ matrix.python-version }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.9", "3.10", "3.11", "3.12"] + runs-on: ${{ matrix.os }} + steps: + - name: Clone Repository + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Set up Poetry + uses: abatilo/actions-poetry@v3 + with: + poetry-version: 1.8.3 + - name: Run Tests + run: make run_tests + - name: Upload Coverage + uses: codecov/codecov-action@v4 + - name: Run Tests with pydantic v1 + run: | + pip install pydantic==1.10.12 + make tests_only publish: - name: Manual PyPi Publish + name: "supabase_auth: Manual PyPi Publish" + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/supabase_auth + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - name: Clone Repository + uses: actions/checkout@v4 + - name: Set up Python '3.11' + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Set up Poetry + uses: abatilo/actions-poetry@v3 + with: + poetry-version: 1.8.3 + + - name: Install dependencies + run: poetry install + + - name: Build package distribution directory + id: build_dist + run: make build_package + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + publish_legacy: + name: "gotrue: Manual PyPi Publish" runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/gotrue + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - name: Clone Repository uses: actions/checkout@v4 - - name: Set up Python '3.10' + - name: Set up Python '3.11' uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" + + - name: Rename Project + id: rename_project + run: make rename_project + - name: Set up Poetry uses: abatilo/actions-poetry@v3 with: - poetry-version: 1.7.1 + poetry-version: 1.8.3 + - name: Setup a local virtual environment (if no poetry.toml file) + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - uses: actions/cache@v4 + name: Define a cache for the virtual environment based on the dependencies lock file + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} - name: Install dependencies run: poetry install - - name: Publish to PyPi - run: poetry publish --build -u ${{ github.event.inputs.username }} -p ${{ github.event.inputs.password }} + + - name: Build package distribution directory + id: build_dist + run: make build_package + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1