Skip to content
README.md 2.35 KiB
Newer Older
# @semantic-release/uv

> [**semantic-release**](https://github.com/semantic-release/semantic-release)
> plugin to publish a [`uv`](https://docs.astral.sh/uv) package.

| Step               | Description                                                                                                           |
| ------------------ | --------------------------------------------------------------------------------------------------------------------- |
| `verifyConditions` | Verify the presence of the `UV_PUBLISH_TOKEN_*` environment variables, and verify the authentication method is valid. |
| `prepare`          | Bump the project version and [build][building] it.                                                                    |
| `publish`          | [Publish the package][publishing] to the repositories.                                                                |

## Getting Started

```sh
npm config --location project set registry https://gitlab.arm.com/api/v4/groups/semantic-release/-/packages/npm/
npm install --save-dev @semantic-release/uv
```

Add the following to `.releaserc.yaml`:

```yaml
plugins:
  - path: "@semantic-release/uv"
    repositories:
      gitlab: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
```

## Configuration

### `repositories`

The mapping of repository names to PyPI endpoint URLs.

Can use environment variables within the URL via `lodash` templating.

### Authentication

The authentication is found in the environment variables as described by the [`uv` documentation][publishing].

Where `$REPO` is the uppercase version of a repository name, provide either a token:

- `UV_PUBLISH_TOKEN_$REPO`

or, a username and password:

- `UV_PUBLISH_USERNAME_$REPO`
- `UV_PUBLISH_PASSWORD_$REPO`

#### GitLab

Creating a [Deploy Token][deploy-token] with `write_package_registry` permission is the preferred method to restrict the access.
The deploy token can be used with the `uv` username/password authentication to publish packages.

### `uv`

By default this plugin automatically downloads hermetic `uv` binaries from GitHub.

You can use this option to provide a path to a locally installed `uv` CLI instead.


[publishing]: https://docs.astral.sh/uv/guides/publish/#publishing-your-package
[building]: https://docs.astral.sh/uv/guides/publish/#building-your-package
[deploy-token]: https://docs.gitlab.com/ee/user/project/deploy_tokens/