docs

你正在阅读 v0.1.2 的文档。Nabi 0.1.2 已不再提供支持。 最新版本:v0.1.3 →

本页尚未翻译,以下为英文原文。

#Publishing Packages

本页内容

How to put your own library or program on the package registry, packages.nabi-lang.org, and keep it there. Using packages is covered in chapter 11, and features in chapter 18.

Important

For now only the registry's maintainers can publish. Anyone can sign in and use packages, but nabi login refuses an account that cannot publish yet.

#How the registry works

The registry's data is a single git repository, the index. Each version of a package is one line in it, naming a commit of the package's own git repository and that commit's tree hash. You upload no source: when a version is published, the registry fetches that commit, keeps an archive of it and writes the archive's SHA-256 into the line. Users download the archive and check it against the index, so a version outlives its repository. Lines are written only by the registry: the index takes no pull requests. The line format is described in the index README.

Packages published from the nabi-lang organization are marked Official; they come with the toolchain (chapter 11).

#The pages

PageWhat it covers
Publishing a packagewhat a package needs, nabi login, nabi publish, names and owners, the docs the registry makes, nabi yank
Trusted publishingpublishing from GitHub Actions with no stored token
Keeping an API stable#[deprecated], #[non_exhaustive] and #[sealed]

The registry's own rules are on the registry: the usage policy, the terms of use and the privacy notice.

  1. 1
    Publishing a Package

    Publishing adds one line to the registry index, pointing at a commit of your git repository (how the registry works). This page goes from the manifest to a published version, and how to withdraw one.

  2. 2
    Trusted Publishing

    A GitHub Actions workflow can publish a package without any token stored in the repository. GitHub gives each job an OIDC token that says which repository, workflow and environment it runs for; the registry checks GitHub's signature on it and, when the package trusts that workflow, trades it for a publish token that lasts 30 minutes and works for that package only. It is the same scheme as crates.io's, PyPI's and npm's trusted publishing.

  3. 3
    Keeping an API Stable

    Users of a published package build against it with a version requirement such as ^0.3, so a release in that range must not break their code. This page shows how to retire an API and how to leave room to grow.

Found a mistake? Edit this page on GitHub. Last updated