From 7ef4b6642b77f99689259f289be18b6fc410c1ec Mon Sep 17 00:00:00 2001 From: nicolargo Date: Sat, 16 Nov 2024 14:52:23 +0100 Subject: [PATCH] Try new build and publish to Pypi CI actions --- .github/workflows/build.yml | 92 ++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f522b78..f0c977f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,12 +18,6 @@ env: on: workflow_call: secrets: - TEST_PYPI_API_TOKEN: - description: 'Test PyPI API token' - required: true - PYPI_API_TOKEN: - description: 'PyPI API token' - required: true DOCKER_USERNAME: description: 'Docker Hub username' required: true @@ -33,54 +27,76 @@ on: jobs: - pypi: + build: + name: Build distribution 📦 runs-on: ubuntu-latest - - permissions: - attestations: write - id-token: write - steps: - - uses: actions/checkout@v4 - - - name: Upgrade pip + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + - name: Install pypa/build run: >- - python -m - pip install - --upgrade - pip - - - name: Install build tools - run: >- - python -m + python3 -m pip install build --user - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ - - name: Publish distribution package to Test PyPI - if: github.ref == 'refs/heads/develop' + pypi: + name: Publish Python 🐍 distribution 📦 to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/glances + permissions: + attestations: write + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - repository-url: https://test.pypi.org/legacy/ - #https://github.com/nicolargo/glances/issues/3020 - #skip-existing: false skip-existing: true attestations: false - - name: Publish distribution package to PyPI - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + pypi_test: + name: Publish Python 🐍 distribution 📦 to TestPyPI + if: github.event_name == 'push' && github.ref == 'refs/heads/develop' + needs: + - build + runs-on: ubuntu-latest + environment: + name: testpypi + url: https://pypi.org/p/glances + permissions: + attestations: write + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - skip-existing: true + repository-url: https://test.pypi.org/legacy/ + skip-existing: false attestations: false create_Docker_builds: