Implementation:Langchain ai Langchain Release Workflow Dispatch
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:
build: Runs onubuntu-latestwith read-only permissions. Usesuv buildto create the distribution, uploads the artifact, and extractspkg-nameandversionfrompyproject.toml. Only runs on the master branch (or whendangerous-nonmaster-releaseis set).release-notes: Generates release notes from git commit history between the current and previous version tags. Handles both regular versions and pre-release versions.test-pypi-publish: Publishes to Test PyPI using trusted publishing (OIDC). Usesskip-existing: trueto tolerate duplicate uploads.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.test-prior-published-packages-against-new-core: Only runs forlibs/corereleases. Checks out the latest published version of partner packages and runs their integration tests against the new core build.test-dependents: Only runs forlibs/coreandlibs/langchain_v1releases. Tests external packages (e.g.,deepagents) against the new release.publish: Publishes to production PyPI using trusted publishing. Only runs after all previous jobs succeed.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