Skip to content

Conversation

@jkebinger
Copy link
Contributor

Summary

Backports the publish workflow from ReforgeHQ/sdk-python and adapts it for prefab-cloud-python.

This adds automated publishing to PyPI when changes are pushed to main.

Features

Smart version checking - Queries PyPI API before publishing to prevent duplicate releases
Trusted publishing - Uses OIDC authentication (no API tokens needed)
Test before publish - Runs full test suite before building/publishing
Manual trigger - Can be triggered via workflow_dispatch
Conditional execution - Skips all steps if version already exists on PyPI

Workflow Triggers

  • Automatic: On push to main branch
  • Manual: Via GitHub Actions UI (workflow_dispatch)

How It Works

  1. Version Check: Reads version from pyproject.toml and checks PyPI
  2. Skip if exists: If version already on PyPI, skips all remaining steps
  3. Install & Test: Sets up Poetry, installs dependencies, runs tests
  4. Build: Creates distribution packages with poetry build
  5. Publish: Uses PyPI's official action with trusted publishing

Differences from sdk-python

Adapted for prefab-cloud-python:

  • ✅ Reads version from pyproject.toml (instead of VERSION file)
  • ✅ Uses prefab-cloud-python as PyPI package name
  • ✅ Uses PREFAB_INTEGRATION_TEST_API_KEY secret (instead of REFORGE_*)
  • ✅ Runs tests with -k 'not integration' filter (matches CI workflow)

PyPI Configuration

Package: prefab-cloud-python

Setup Required

Before this can work, you'll need to:

  1. Configure PyPI Trusted Publishing (in PyPI account settings):

    • Publisher: GitHub
    • Owner: prefab-cloud
    • Repository: prefab-cloud-python
    • Workflow: publish.yml
    • Environment: release
  2. Create GitHub environment named release (optional, for extra protection)

Testing

To test without publishing:

  • Bump version in pyproject.toml to a version that already exists on PyPI
  • The workflow will detect it and skip publishing

🤖 Generated with Claude Code

Backports the publish workflow from ReforgeHQ/sdk-python and adapts it
for prefab-cloud-python.

Key features:
- Triggers on push to main or manual workflow dispatch
- Checks PyPI before publishing to prevent duplicate releases
- Uses trusted publishing (OIDC) for secure authentication
- Runs tests before publishing
- Only publishes if version doesn't already exist on PyPI

Changes from sdk-python workflow:
- Uses pyproject.toml for version (instead of VERSION file)
- Uses prefab-cloud-python as PyPI package name
- Uses PREFAB_INTEGRATION_TEST_API_KEY secret
- Runs pytest with '-k not integration' filter (matches CI)

PyPI coordinates: https://pypi.org/project/prefab-cloud-python

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jkebinger jkebinger requested a review from a team as a code owner November 20, 2025 15:58
Copy link
Contributor

@jdwyah jdwyah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@jkebinger jkebinger merged commit ade55d2 into main Nov 20, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants