This repository was archived by the owner on Mar 18, 2025. It is now read-only.
Publish to PyPI #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPI | |
on: | |
release: | |
types: [created] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: latest | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Set version from release tag | |
run: | | |
# Extract version from tag (remove 'v' prefix if present) | |
VERSION=${GITHUB_REF#refs/tags/} | |
VERSION=${VERSION#v} | |
# Update version in pyproject.toml | |
poetry version $VERSION | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Download and setup lume binary | |
run: | | |
# Create a temporary directory for extraction | |
mkdir -p temp_lume | |
# Download the lume release (silently) | |
curl -sL "https://github.com/trycua/lume/releases/download/v${VERSION}/lume.tar.gz" -o temp_lume/lume.tar.gz | |
# Extract the tar file (ignore ownership and suppress warnings) | |
cd temp_lume && tar --no-same-owner -xzf lume.tar.gz | |
# Make the binary executable | |
chmod +x lume | |
# Copy the lume binary to the correct location | |
cp lume "${GITHUB_WORKSPACE}/pylume/lume" | |
# Verify the binary exists and is executable | |
test -x "${GITHUB_WORKSPACE}/pylume/lume" || { echo "lume binary not found or not executable"; exit 1; } | |
# Cleanup | |
cd "${GITHUB_WORKSPACE}" && rm -rf temp_lume | |
- name: Build and publish | |
env: | |
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
poetry config pypi-token.pypi $PYPI_TOKEN | |
poetry build | |
# Verify the binary is in the wheel | |
python -m pip install wheel | |
wheel unpack dist/*.whl --dest temp_wheel | |
test -f temp_wheel/pylume-*/pylume/lume || { echo "lume binary not found in wheel"; exit 1; } | |
rm -rf temp_wheel | |
poetry publish |