Add Forgejo PyPI support and update .gitignore for sensitive files
This commit is contained in:
parent
b8a7fb903e
commit
4fd9f13f36
7 changed files with 636 additions and 55 deletions
98
upload_wheel_to_forgejo_pypi.sh
Normal file
98
upload_wheel_to_forgejo_pypi.sh
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
#!/bin/bash
|
||||
# upload_wheel_to_forgejo_pypi.sh
|
||||
# Upload wheel to Forgejo PyPI for Elytra PIM Client
|
||||
#
|
||||
# Prerequisites:
|
||||
# 1. Create .pypirc file in project root
|
||||
# 2. Copy from .pypirc.example and add your credentials
|
||||
#
|
||||
# Usage:
|
||||
# ./upload_wheel_to_forgejo_pypi.sh [--build]
|
||||
# Options: --build Force rebuild before upload
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PYPIRC_SRC="$PROJECT_ROOT/.pypirc"
|
||||
PYPIRC_DEST="$HOME/.pypirc"
|
||||
|
||||
echo ""
|
||||
echo "========================================================================"
|
||||
echo "Elytra PIM Client - Upload to Forgejo PyPI"
|
||||
echo "========================================================================"
|
||||
echo ""
|
||||
|
||||
# Check for .pypirc
|
||||
if [ ! -f "$PYPIRC_SRC" ]; then
|
||||
echo "[!] .pypirc not found in project root!"
|
||||
echo ""
|
||||
echo "Setup instructions:"
|
||||
echo " 1. cp .pypirc.example .pypirc"
|
||||
echo " 2. Edit .pypirc with your Forgejo credentials"
|
||||
echo " 3. Run this script again"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Copy .pypirc to user home
|
||||
echo "Configuring credentials..."
|
||||
cp "$PYPIRC_SRC" "$PYPIRC_DEST"
|
||||
chmod 600 "$PYPIRC_DEST"
|
||||
|
||||
# Activate virtual environment
|
||||
source "$PROJECT_ROOT/.venv/bin/activate"
|
||||
|
||||
# Install twine if needed
|
||||
if ! pip list 2>/dev/null | grep -q "^twine "; then
|
||||
echo "Installing twine..."
|
||||
pip install -q twine
|
||||
fi
|
||||
|
||||
# Check for --build flag
|
||||
if [ "$1" = "--build" ]; then
|
||||
echo "Building wheel (forced)..."
|
||||
rm -rf "$PROJECT_ROOT/dist"
|
||||
cd "$PROJECT_ROOT"
|
||||
python build_wheel.py
|
||||
if [ $? -ne 0 ]; then
|
||||
rm -f "$PYPIRC_DEST"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Build wheel if not present
|
||||
if ! ls "$PROJECT_ROOT/dist"/*.whl > /dev/null 2>&1; then
|
||||
echo "Building wheel..."
|
||||
cd "$PROJECT_ROOT"
|
||||
python build_wheel.py
|
||||
if [ $? -ne 0 ]; then
|
||||
rm -f "$PYPIRC_DEST"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Upload to Forgejo PyPI
|
||||
echo ""
|
||||
echo "========================================================================"
|
||||
echo "Uploading to Forgejo PyPI..."
|
||||
echo "========================================================================"
|
||||
echo ""
|
||||
|
||||
cd "$PROJECT_ROOT"
|
||||
twine upload -r forgejo dist/*.whl
|
||||
UPLOAD_RESULT=$?
|
||||
|
||||
# Cleanup
|
||||
rm -f "$PYPIRC_DEST"
|
||||
|
||||
echo ""
|
||||
echo "========================================================================"
|
||||
if [ $UPLOAD_RESULT -eq 0 ]; then
|
||||
echo "Upload successful!"
|
||||
else
|
||||
echo "Upload failed"
|
||||
fi
|
||||
echo "========================================================================"
|
||||
echo ""
|
||||
|
||||
exit $UPLOAD_RESULT
|
||||
Loading…
Add table
Add a link
Reference in a new issue