Try new build and publish to Pypi CI actions

This commit is contained in:
nicolargo 2024-11-16 14:52:23 +01:00
parent 77e3c4968d
commit 7ef4b6642b

View File

@ -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: