Skip to content

Commit

Permalink
feat: support custom registries (#18)
Browse files Browse the repository at this point in the history
Closes #15
  • Loading branch information
baptiste0928 authored Sep 7, 2023
1 parent 0ce1c96 commit eb2b7c0
Show file tree
Hide file tree
Showing 8 changed files with 306 additions and 171 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Support alternative registries with the `registry` and `index` input
parameters.

### Changed
- Crate versions are fetched from the sparse index instead of the crates.io
API.
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ and automatically caches the resulting binaries to speed up subsequent builds.
| **v2.0:** This major update introduces some breaking changes. Read the [changelog] before updating. |

## Features
- Install any Rust binary crate from [crates.io] or a git repository.
- Install any Rust binary crate from [crates.io], a git repository or an
alternate registry.
- Automatically cache installed binaries to avoid compiling them each run.
- Keep crates updated, with an optional version range to avoid breakages.
- Works on Linux, Windows and MacOS runners.
Expand Down Expand Up @@ -65,6 +66,16 @@ unexpected dependencies updates.
`branch`, `tag` and `commit`/`rev` are mutually exclusive. If none of them are
specified, the latest commit of the default branch will be used.

#### Alternate registry parameters
- `registry`: Registry name from the Cargo configuration. See
[Using an alternate registry](https://doc.rust-lang.org/nightly/cargo/reference/registries.html#using-an-alternate-registry)
on the Cargo Book.
- `index`: URL of the registry index.

`registry` and `index` are mutually exclusive. Only sparse `index` support
version range resolution, you'll need to specify an exact version when using
`registry` or a non-sparse `index`.

### Outputs
- `version`: The version of the crate that has been installed.
- `cache-hit`: A boolean indicating whether the crate was restored from cache.
Expand Down
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ inputs:
description: "Additional key added to the automatic cache key."
required: false

# Crates.io installation
# Registry installation
version:
description: "Version of the crate to install."
required: true
default: "latest"
registry:
description: "Registry to install the crate from."
required: false
index:
description: "Registry index to install the crate from."
required: false

# Git installation
git:
Expand Down
Loading

0 comments on commit eb2b7c0

Please sign in to comment.