Add CI workflow
Some checks failed
Publish Python Packages Dynamically / detect-and-publish (push) Failing after 6s
Some checks failed
Publish Python Packages Dynamically / detect-and-publish (push) Failing after 6s
This commit is contained in:
59
.gitea/workflows/publish.yml
Normal file
59
.gitea/workflows/publish.yml
Normal 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: pip install 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
|
Reference in New Issue
Block a user