From 834b2fe1c07ca4b40a40ee8588a3a937d44bbcb6 Mon Sep 17 00:00:00 2001 From: Synchon Mandal Date: Fri, 24 Jan 2025 16:13:33 +0100 Subject: [PATCH] chore: update and replace pypi.yml with publish.yml --- .github/workflows/publish.yml | 46 +++++++++++++++++++++++++++++++++++ .github/workflows/pypi.yml | 31 ----------------------- 2 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..cfcd213111 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,46 @@ +name: Build and publish + +on: + push: + branches: + - main + tags: + - 'v*' + +jobs: + build-and-publish: + name: Build and publish + runs-on: ubuntu-latest + permissions: + # Needed for PyPI publishing + id-token: write + # Needed for GitHub releases + contents: write + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install build + run: + python -m pip install --upgrade pip + python -m pip install build + - name: Build package + run: + python -m build + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + - name: Make release on GitHub + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + dist/*.tar.gz + dist/*.whl + generate_release_notes: true + make_latest: true diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml deleted file mode 100644 index 4f3af63435..0000000000 --- a/.github/workflows/pypi.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Build and publish to PyPI -on: - push: - branches: - - main - tags: - - 'v*' -jobs: - build-n-publish: - name: Build and publish to PyPI - runs-on: ubuntu-latest - steps: - - name: Checkout source - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - name: Install build - run: - pip install build - - name: Build a binary wheel and a source tarball - run: - python -m build --sdist --wheel --outdir dist/ . - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.pypi_token }}