Add CI workflow
Some checks failed
Publish Python Packages Dynamically / detect-and-publish (push) Failing after 10s

This commit is contained in:
lionel
2025-07-08 15:03:53 +02:00
parent 4bb36fe4c8
commit 59e610d642

View File

@ -0,0 +1,59 @@
name: Publish Python Packages Dynamically
on:
push:
branches: [master]
workflow_dispatch:
jobs:
detect-and-publish:
runs-on: docker
steps:
- uses: actions/checkout@v3
- name: 🔧 Installer les outils Python
run: python3 -m pip install --break-system-packages setuptools wheel twine
- name: 🔍 Trouver les projets modifiés
id: detect
run: |
git fetch origin master --depth=2 || true
CHANGED=$(git diff --name-only HEAD~1 HEAD)
echo "CHANGED PATHS:"
echo "$CHANGED"
# Trouver tous les dossiers avec un setup.py
for dir in */; do
if [ -f "$dir/setup.py" ]; then
for f in $CHANGED; do
if [[ "$f" == "$dir"* ]]; then
echo "🟢 Modification détectée dans $dir"
echo "$dir" >> changed_projects.txt
break
fi
done
fi
done
if [ ! -s changed_projects.txt ]; then
echo "Aucun projet modifié."
exit 0
fi
- name: 🚀 Build & Publish
if: success()
run: |
while read dir; do
echo "🔨 Build & publication de $dir"
cd "$dir"
python setup.py sdist
twine upload \
--repository-url https://gitea.example.com/api/packages/<user>/pypi \
-u "${{ secrets.REGISTRY_USERNAME }}" \
-p "${{ secrets.REGISTRY_PASSWORD }}" \
dist/* || exit 1
cd ..
done < changed_projects.txt