From 0379cac6a5d68f4f9bf81c18c638724dfe759959 Mon Sep 17 00:00:00 2001 From: rxu17 <26471741+rxu17@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:48:27 -0800 Subject: [PATCH 1/6] test upload with pypi and oidc --- .github/workflows/ci.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 292f51d2..2a35c0ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,10 +57,9 @@ jobs: - uses: actions/checkout@v2 - uses: psf/black@stable - deploy: + build: needs: [test, lint] runs-on: ubuntu-latest - if: github.event_name == 'release' steps: - uses: actions/checkout@v2 - name: Set up Python @@ -71,10 +70,15 @@ jobs: run: | python -m pip install --upgrade pip pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + - name: Build distributions run: | python setup.py sdist bdist_wheel - twine upload dist/* + + publish: + needs: [test, lint, build] + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Publish to pypi + uses: pypa/gh-action-pypi-publish@release/v1 From abecbe0414b5e96cf636e147e416fa4c97a8297a Mon Sep 17 00:00:00 2001 From: rxu17 <26471741+rxu17@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:01:33 -0800 Subject: [PATCH 2/6] update to use build instead of setup.py --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a35c0ee..124de1b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: - uses: actions/checkout@v2 - uses: psf/black@stable - build: + build-dist: needs: [test, lint] runs-on: ubuntu-latest steps: @@ -69,13 +69,12 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install setuptools wheel build - name: Build distributions - run: | - python setup.py sdist bdist_wheel + run: python -m build publish: - needs: [test, lint, build] + needs: [test, lint, build-dist] runs-on: ubuntu-latest permissions: id-token: write From 336252aa300dd750e992185f22e32d0e9ff7ad6b Mon Sep 17 00:00:00 2001 From: rxu17 <26471741+rxu17@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:10:16 -0800 Subject: [PATCH 3/6] check dist dir --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 124de1b9..1586ea3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,6 +72,8 @@ jobs: pip install setuptools wheel build - name: Build distributions run: python -m build + - name: List contents of dist directory + run: ls -l dist publish: needs: [test, lint, build-dist] From ddfdfacec88699e8838e22ffdc5d13aacb38a903 Mon Sep 17 00:00:00 2001 From: rxu17 <26471741+rxu17@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:30:54 -0800 Subject: [PATCH 4/6] try merging build and publish --- .github/workflows/ci.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1586ea3c..01f185dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,9 +57,11 @@ jobs: - uses: actions/checkout@v2 - uses: psf/black@stable - build-dist: + build-and-publish: needs: [test, lint] runs-on: ubuntu-latest + permissions: + id-token: write steps: - uses: actions/checkout@v2 - name: Set up Python @@ -74,12 +76,5 @@ jobs: run: python -m build - name: List contents of dist directory run: ls -l dist - - publish: - needs: [test, lint, build-dist] - runs-on: ubuntu-latest - permissions: - id-token: write - steps: - name: Publish to pypi uses: pypa/gh-action-pypi-publish@release/v1 From ff353665eef9959054e19395ee157898d6e603ed Mon Sep 17 00:00:00 2001 From: rxu17 <26471741+rxu17@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:36:08 -0800 Subject: [PATCH 5/6] add back in condition to deploy on release --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01f185dc..49fe1f7f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,9 +57,10 @@ jobs: - uses: actions/checkout@v2 - uses: psf/black@stable - build-and-publish: + deploy: needs: [test, lint] runs-on: ubuntu-latest + if: github.event_name == 'release' permissions: id-token: write steps: From 70497bf710aafa3da6e9a56e9ccedb5e3215f3e1 Mon Sep 17 00:00:00 2001 From: rxu17 <26471741+rxu17@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:39:38 -0800 Subject: [PATCH 6/6] remove listing of dist dir --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49fe1f7f..2dfd3558 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,5 @@ jobs: pip install setuptools wheel build - name: Build distributions run: python -m build - - name: List contents of dist directory - run: ls -l dist - name: Publish to pypi uses: pypa/gh-action-pypi-publish@release/v1