Skip to content

Add github workflow for automatic PyPI releases#357

Merged
urchade merged 1 commit into
mainfrom
auto-pypi-releases
May 1, 2026
Merged

Add github workflow for automatic PyPI releases#357
urchade merged 1 commit into
mainfrom
auto-pypi-releases

Conversation

@Ingvarstep
Copy link
Copy Markdown
Collaborator

@Ingvarstep Ingvarstep commented Apr 30, 2026

Add Automated PyPI Release Workflow

Summary

Adds GitHub Actions workflow to automate PyPI releases when version tags are pushed to the main branch.

What it does

  • Triggers on version tags (e.g., v1.0.0, v2.1.3)
  • Builds distribution packages (wheel + source)
  • Verifies tag is on main branch before publishing
  • Publishes to PyPI using trusted publishing

Required actions

1. Configure PyPI Trusted Publishing (Required before first release)

What is Trusted Publishing?
Trusted Publishing allows GitHub Actions to publish to PyPI without using API tokens or passwords. It uses OpenID Connect (OIDC) for secure authentication directly from GitHub.

Benefits:

  • No API tokens to manage or rotate
  • More secure (no credentials in secrets)
  • Recommended by PyPI as best practice

Setup Steps:

  1. Log in to PyPI at https://pypi.org (you must be a maintainer/owner of the gliner package)

  2. Navigate to Publishing Settings:

  3. Add a new pending publisher with these values:

    • PyPI Project Name: gliner
    • Owner: urchade (or your GitHub org/username)
    • Repository name: GLiNER
    • Workflow name: release.yaml
    • Environment name: pypi
  4. Save - The publisher will be in "pending" state until the first successful workflow run

Official Documentation:

Note: If trusted publishing is not configured, the workflow will fail at the publish step with an authentication error.

2. To trigger a release

Push a version tag to main:

git tag v0.4.0 && git push origin v0.4.0

3. Documentation updated

RELEASE.md now includes automated release instructions

Safety

  • Only tags from main branch will be published
  • Failed branch verification prevents accidental releases from feature branches

@Ingvarstep Ingvarstep requested review from tomaarsen and urchade April 30, 2026 10:37
@urchade urchade merged commit d2db7f5 into main May 1, 2026
3 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.

2 participants