mirror of
https://github.com/astral-sh/ruff.git
synced 2026-10-28 10:45:37 +08:00
## Summary Publish Ruff's production Rust crates to crates.io as part of the existing release workflow. This follows uv's setup: workspace dependencies carry registry-compatible version pins, internal crates receive generated READMEs and an explicit versioning policy, CI dry-runs the full workspace publish, and release jobs publish missing crate versions idempotently through crates.io trusted publishing. The publishing set contains 32 packages: Ruff's CLI, WASM package, server, linter, formatter, parser, and the internal Ruff component crates required by them. It also includes `ty_module_resolver`, `ty_site_packages`, and `ty_static`, because those three crates are part of Ruff's normal dependency closure. The publishing set deliberately excludes: - Test-only crates: `mdtest`, `ruff_mdtest`, `ruff_python_ast_integration_tests`, and `ruff_python_trivia_integration_tests`. - Benchmark and development crates: `ruff_benchmark` and `ruff_dev`. - All remaining `ty_*` crates. These packages retain `publish = false`, so bootstrap, version bumping, README generation, CI dry-runs, and release publishing skip them through Cargo metadata instead of a separate hard-coded allowlist. The crates.io job is intentionally independent of release announcement, so a crates.io outage cannot block the existing binary, PyPI, npm, or GitHub release outputs. A bootstrap script reserves new crate names, configures the release workflow as each crate's trusted publisher, enables trusted-publishing-only releases, and records configured crates for idempotent reruns. The full workspace publish dry-run packages and verifies all 32 selected crates. Closes https://github.com/astral-sh/ruff/issues/43.
39 lines
1.4 KiB
YAML
39 lines
1.4 KiB
YAML
# Publish a release to crates.io.
|
|
#
|
|
# Assumed to run as a subworkflow of .github/workflows/release.yml; specifically, as a publish job
|
|
# within `cargo-dist`.
|
|
name: "Publish to crates.io"
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
plan:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
crates-publish-ruff:
|
|
name: Upload Ruff to crates.io
|
|
runs-on: ubuntu-latest
|
|
environment:
|
|
name: release
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
- uses: rust-lang/crates-io-auth-action@bbd81622f20ce9e2dd9622e3218b975523e45bbe # v1.0.4
|
|
id: auth
|
|
- name: Install nightly toolchain
|
|
# Nightly is required for the unstable `-Zpublish-timeout` flag, which lets us
|
|
# raise the per-crate wait above the 60s default. crates.io indexing has been
|
|
# known to lag long enough to exceed that during workspace publishes.
|
|
run: rustup toolchain install nightly-2026-06-12 --profile minimal --no-self-update
|
|
- name: Publish workspace crates
|
|
# Note `--no-verify` is safe because we do a publish dry-run elsewhere in CI
|
|
run: python3 scripts/publish-crates.py --cargo cargo +nightly-2026-06-12 --no-verify -- -Zpublish-timeout --config 'publish.timeout=600'
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
|