Use Python virtual environment to avoid externally-managed-environment error
This commit is contained in:
@@ -25,40 +25,31 @@ jobs:
|
|||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
run: |
|
run: |
|
||||||
python3 --version
|
python3 --version
|
||||||
# Add user bin to PATH for all steps
|
# Create virtual environment
|
||||||
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV
|
python3 -m venv venv
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
source venv/bin/activate
|
||||||
# Install pip if not available (without sudo)
|
# Upgrade pip in venv
|
||||||
if ! command -v pip3 &> /dev/null 2>&1 && ! python3 -m pip --version &> /dev/null 2>&1; then
|
pip install --upgrade pip
|
||||||
# Try curl first, then wget
|
# Make venv available for all steps
|
||||||
if command -v curl &> /dev/null; then
|
echo 'source venv/bin/activate' >> $GITHUB_ENV
|
||||||
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
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
source venv/bin/activate
|
||||||
python3 -m pip install --upgrade pip --user
|
pip install --upgrade pip
|
||||||
python3 -m pip install -r requirements.txt --user
|
pip install -r requirements.txt
|
||||||
|
|
||||||
- name: Run update script
|
- name: Run update script
|
||||||
run: |
|
run: |
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
source venv/bin/activate
|
||||||
python3 update_laws.py
|
python update_laws.py
|
||||||
continue-on-error: true # Weiterlaufen auch bei Fehlern
|
continue-on-error: true # Weiterlaufen auch bei Fehlern
|
||||||
|
|
||||||
- name: Convert XML to Markdown
|
- name: Convert XML to Markdown
|
||||||
if: success() || failure() # Immer ausführen, auch wenn Update fehlschlug
|
if: success() || failure() # Immer ausführen, auch wenn Update fehlschlug
|
||||||
run: |
|
run: |
|
||||||
export PATH="$HOME/.local/bin:$PATH"
|
source venv/bin/activate
|
||||||
python3 xml_to_markdown.py --prod || echo "Konvertierung fehlgeschlagen oder keine Änderungen"
|
python xml_to_markdown.py --prod || echo "Konvertierung fehlgeschlagen oder keine Änderungen"
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Check for changes
|
- name: Check for changes
|
||||||
|
|||||||
Reference in New Issue
Block a user