Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Langchain ai Langchain Release Workflow Dispatch

From Leeroopedia

Template:Metadata

Overview

Concrete GitHub Actions workflow for building and publishing LangChain packages to PyPI, provided by the _release.yml reusable workflow.

Description

The _release.yml workflow is the LangChain monorepo's release pipeline, triggered either manually via workflow_dispatch or programmatically via workflow_call. It orchestrates the full release lifecycle: build, test, publish to Test PyPI, run pre-release checks, publish to production PyPI, and create a GitHub release.

Workflow inputs:

Input Required Default Description
working-directory Yes libs/langchain_v1 Package directory relative to repo root
release-version Yes 0.1.0 Semantic version to release
dangerous-nonmaster-release No false Allow release from non-master branch (hotfixes only)

Jobs in the workflow:

  1. build: Runs on ubuntu-latest with read-only permissions. Uses uv build to create the distribution, uploads the artifact, and extracts pkg-name and version from pyproject.toml. Only runs on the master branch (or when dangerous-nonmaster-release is set).
  2. release-notes: Generates release notes from git commit history between the current and previous version tags. Handles both regular versions and pre-release versions.
  3. test-pypi-publish: Publishes to Test PyPI using trusted publishing (OIDC). Uses skip-existing: true to tolerate duplicate uploads.
  4. pre-release-checks: Installs the built wheel, runs unit tests, checks for prerelease dependencies, tests minimum dependency versions, and runs integration tests (for partner packages only). Uses real API credentials from GitHub secrets.
  5. test-prior-published-packages-against-new-core: Only runs for libs/core releases. Checks out the latest published version of partner packages and runs their integration tests against the new core build.
  6. test-dependents: Only runs for libs/core and libs/langchain_v1 releases. Tests external packages (e.g., deepagents) against the new release.
  7. publish: Publishes to production PyPI using trusted publishing. Only runs after all previous jobs succeed.
  8. mark-release: Creates a Git tag (<pkg-name>==<version>) and a GitHub Release with generated release notes.

Environment:

env:
  PYTHON_VERSION: "3.11"
  UV_FROZEN: "true"
  UV_NO_SYNC: "true"

Usage

This workflow is triggered manually from the GitHub Actions UI or via the GitHub API. It is also invocable as a reusable workflow from other workflows.

Code Reference

Source Location: .github/workflows/_release.yml, Lines 1-621

Workflow trigger signature:

name: "Package Release"
run-name: "Release ${{ inputs.working-directory }} ${{ inputs.release-version }}"
on:
  workflow_call:
    inputs:
      working-directory:
        required: true
        type: string
        description: "From which folder this pipeline executes"
  workflow_dispatch:
    inputs:
      working-directory:
        required: true
        type: string
        description: "From which folder this pipeline executes"
        default: "libs/langchain_v1"
      release-version:
        required: true
        type: string
        default: "0.1.0"
        description: "New version of package being released"
      dangerous-nonmaster-release:
        required: false
        type: boolean
        default: false
        description: "Release from a non-master branch (danger!)"

Build job version extraction:

import os
import tomllib
with open("pyproject.toml", "rb") as f:
    data = tomllib.load(f)
pkg_name = data["project"]["name"]
version = data["project"]["version"]
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
    f.write(f"pkg-name={pkg_name}\n")
    f.write(f"version={version}\n")

I/O Contract

Input Type Description
working-directory string Path to the package directory (e.g., libs/partners/deepseek)
release-version string Semantic version string (e.g., 1.1.0)
dangerous-nonmaster-release boolean Override to allow non-master branch releases
GitHub secrets env vars API keys for integration tests (OPENAI_API_KEY, DEEPSEEK_API_KEY, etc.)
Output Type Description
PyPI package Published wheel Package available on pypi.org
Test PyPI package Published wheel Package available on test.pypi.org
GitHub Release Git tag + release Tag <pkg-name>==<version> with changelog body
Build artifact dist/*.whl Uploaded as GitHub Actions artifact

Usage Examples

Triggering a release via GitHub UI:

1. Navigate to Actions > "Package Release" workflow
2. Click "Run workflow"
3. Set working-directory: libs/partners/deepseek
4. Set release-version: 1.2.0
5. Leave dangerous-nonmaster-release unchecked
6. Click "Run workflow"

Triggering a release via GitHub CLI:

gh workflow run _release.yml \
  -f working-directory=libs/partners/deepseek \
  -f release-version=1.2.0

Releasing a hotfix from a non-master branch:

gh workflow run _release.yml \
  --ref hotfix/deepseek-1.1.1 \
  -f working-directory=libs/partners/deepseek \
  -f release-version=1.1.1 \
  -f dangerous-nonmaster-release=true

Typical job execution order:

build
  -> release-notes
    -> test-pypi-publish
      -> pre-release-checks
        -> test-prior-published-packages-against-new-core (core only)
        -> test-dependents (core/langchain_v1 only)
          -> publish
            -> mark-release

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment