diff --git a/.gitea/workflows/update-laws.yaml b/.gitea/workflows/update-laws.yaml index 11bd0a26..62ec6ece 100644 --- a/.gitea/workflows/update-laws.yaml +++ b/.gitea/workflows/update-laws.yaml @@ -25,40 +25,31 @@ jobs: - name: Set up Python run: | python3 --version - # 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 + # Create virtual environment + python3 -m venv venv + source venv/bin/activate + # Upgrade pip in venv + pip install --upgrade pip + # Make venv available for all steps + echo 'source venv/bin/activate' >> $GITHUB_ENV - name: Install dependencies run: | - export PATH="$HOME/.local/bin:$PATH" - python3 -m pip install --upgrade pip --user - python3 -m pip install -r requirements.txt --user + source venv/bin/activate + pip install --upgrade pip + pip install -r requirements.txt - name: Run update script run: | - export PATH="$HOME/.local/bin:$PATH" - python3 update_laws.py + source venv/bin/activate + python 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" + source venv/bin/activate + python xml_to_markdown.py --prod || echo "Konvertierung fehlgeschlagen oder keine Änderungen" continue-on-error: true - name: Check for changes