Improve pip installation: Add curl/wget fallback and ensure PATH in all steps

This commit is contained in:
2025-11-19 23:13:59 +01:00
parent 0a87854b53
commit 8589cfe98e

View File

@@ -25,12 +25,21 @@ jobs:
- name: Set up Python
run: |
python3 --version
# Install pip if not available (without sudo)
if ! command -v pip3 &> /dev/null && ! python3 -m pip --version &> /dev/null; then
curl -sS https://bootstrap.pypa.io/get-pip.py | python3
fi
# Add user bin to PATH
# Add user bin to PATH for all steps
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV
export PATH="$HOME/.local/bin:$PATH"
# Install pip if not available (without sudo)
if ! command -v pip3 &> /dev/null 2>&1 && ! python3 -m pip --version &> /dev/null 2>&1; then
# Try curl first, then wget
if command -v curl &> /dev/null; then
curl -sS https://bootstrap.pypa.io/get-pip.py | python3
elif command -v wget &> /dev/null; then
wget -qO- https://bootstrap.pypa.io/get-pip.py | python3
else
echo "Error: Neither curl nor wget available"
exit 1
fi
fi
python3 -m pip install --upgrade pip --user
- name: Install dependencies
@@ -41,12 +50,14 @@ jobs:
- name: Run update script
run: |
export PATH="$HOME/.local/bin:$PATH"
python3 update_laws.py
continue-on-error: true # Weiterlaufen auch bei Fehlern
- name: Convert XML to Markdown
if: success() || failure() # Immer ausführen, auch wenn Update fehlschlug
run: |
export PATH="$HOME/.local/bin:$PATH"
python3 xml_to_markdown.py --prod || echo "Konvertierung fehlgeschlagen oder keine Änderungen"
continue-on-error: true