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 { sh '''#!/bin/sh find kapitanbooru_uploader/locales -name "*.po" -exec sh -c ' po="$0" mo="${po%.po}.mo" msgfmt "$po" -o "$mo" ' {} \\; ''' } } 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 } } }