From 6d6a4e8d0450d516f3bfa8a19cf9c39ed07c88c3 Mon Sep 17 00:00:00 2001 From: Sergio Garcia <47090312+singiamtel@users.noreply.github.com> Date: Tue, 3 Jun 2025 16:28:42 +0200 Subject: [PATCH] Update release workflow for pyproject.toml (#928) * Update release workflow for pyproject.toml * Update PACKAGING.md --------- Co-authored-by: Giulio Eulisse <10544+ktf@users.noreply.github.com> --- .github/workflows/release.yml | 34 +++++++++++++++------------------- PACKAGING.md | 11 ++--------- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 868f719c..724452bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,30 +9,26 @@ permissions: contents: read # required for github.ref to be set jobs: - pypi: - name: Publish release on PyPI + pypi-publish: + name: Upload release to PyPI runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + environment: + name: pypi + url: https://pypi.org/p/alibuild + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - - name: Checkout bits - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.x - - name: Install build dependencies # needed by our setup.py - run: python -m pip install setuptools - - name: Build the Python distribution - run: python setup.py sdist - - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@v1.5.0 - with: - user: __token__ - password: ${{ secrets.pypi_password }} + # retrieve your distributions here + - name: Install build dependencies + run: python -m pip install --upgrade setuptools build pip + - name: Build the Python distribution + run: python -m build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 brew: name: Update Homebrew formula - needs: pypi + needs: pypi-publish runs-on: macos-latest if: startsWith(github.ref, 'refs/tags/') && !github.event.release.prerelease steps: diff --git a/PACKAGING.md b/PACKAGING.md index f365a2f4..f13de17b 100644 --- a/PACKAGING.md +++ b/PACKAGING.md @@ -7,12 +7,5 @@ alibuild is available from PyPi. Package page at: In order to publish a new version: - Test, test, test. -- Change the tag in setup.py -- Build the source distribution with: - - python setup.py build sdist - -- Publish with: - - twine upload dist/* - +- Create a new release in GitHub. +- The github action should automatically create a new release and upload the package to PyPi (it's a good idea to verify that the release was created and the package uploaded).