From a1c8f3ad12555c916fad4eb05d8b28a34081c865 Mon Sep 17 00:00:00 2001 From: Robert Farmer Date: Wed, 10 Jul 2024 21:27:00 +0100 Subject: [PATCH] Switch pypi publishing --- .github/workflows/publish-to-test-pypi.yml | 42 ---------------------- .github/workflows/pypi.yml | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+), 42 deletions(-) delete mode 100644 .github/workflows/publish-to-test-pypi.yml create mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml deleted file mode 100644 index 94c755a..0000000 --- a/.github/workflows/publish-to-test-pypi.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Publish to pypi and testpypi - -on: push - - -jobs: - build-n-publish: - name: Build and publish Python to pypi and testpypi - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - name: Set up Python 3.9 - uses: actions/setup-python@v1 - with: - python-version: 3.9 - - name: Install pypa/build - run: >- - python -m - pip install - build - --user - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - . - - name: Publish distribution 📦 to Test PyPI - if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - - name: Publish distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..d35260b --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,36 @@ +name: Publish Python 🐍 distribution 📦 to PyPI + +on: push + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/mesaPlot + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing