pipeline { agent { label 'Pi4' } // Use Raspberry Pi 4 agent running on Ubuntu Server LTS 24.04 environment { PIP_EXTRA_INDEX_URL = 'http://localhost:8090/simple/' // Local PyPI repo PACKAGE_NAME = 'kapitanbooru_uploader' // Your package name } stages { stage('Checkout') { steps { checkout scm } } stage('Setup Python') { steps { sh 'python3.13 -m venv venv' // Create a virtual environment sh '. venv/bin/activate && pip install --upgrade pip build twine' } } stage('Compile Translations') { steps { // Find all .po files under kapitanbooru_uploader/locales and compile them to .mo sh ''' find kapitanbooru_uploader/locales -name "*.po" -print0 | while IFS= read -r -d '' po; do mo=$(echo "$po" | sed 's/\\.po$/.mo/'); msgfmt "$po" -o "$mo"; done ''' } } stage('Build Package') { steps { sh '. venv/bin/activate && python -m build' // Builds the package } } stage('Publish to Local PyPI') { steps { sh '. venv/bin/activate && twine upload --repository-url http://localhost:8090/ -u admin -p admin dist/*' } } } post { cleanup { sh 'rm -rf venv dist build *.egg-info' // Clean up build artifacts } } }