-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish as a Cargo package with explicit binary and library targets (#19
) Following @Holzhaus's great feedback in #16 and initial implementation in #17, this configures the project so that it can be published as a Cargo package on [Crates.io](https://crates.io/). The Cargo package exposes a binary target, which can be easily installed with `cargo install litra`, plus a library target which can be used to integrate Litra control into other Rust applications. The package will be automatically published to Crates.io when a release is created.
- Loading branch information
Showing
4 changed files
with
496 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,31 @@ jobs: | |
with: | ||
path: litra_${{ steps.sanitise_ref.outputs.value }}_${{ matrix.job.binary_name }} | ||
name: litra_${{ steps.sanitise_ref.outputs.value }}_${{ matrix.job.binary_name }} | ||
release: | ||
cargo_publish_dry_run: | ||
name: Publish with Cargo in dry-run mode | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install libudev-dev | ||
run: sudo apt-get update && sudo apt-get install libudev-dev | ||
- name: Cache Rust dependencies | ||
uses: actions/[email protected] | ||
with: | ||
path: target | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build- | ||
- name: Install latest Rust nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
components: rustc, cargo | ||
toolchain: nightly | ||
override: true | ||
- name: Publish to Crates.io | ||
run: cargo publish --dry-run | ||
create_github_release: | ||
name: Create release with binary assets | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
@@ -83,7 +107,7 @@ jobs: | |
publish_on_homebrew: | ||
name: Publish release on Homebrew | ||
runs-on: ubuntu-latest | ||
needs: release | ||
needs: create_github_release | ||
if: startsWith(github.event.ref, 'refs/tags/v') | ||
steps: | ||
- name: Get released version | ||
|
@@ -97,4 +121,31 @@ jobs: | |
push-to: timrogers/homebrew-tap | ||
create-pullrequest: true | ||
env: | ||
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} | ||
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} | ||
cargo_publish: | ||
name: Publish with Cargo to Crates.io | ||
runs-on: ubuntu-latest | ||
needs: | ||
- create_github_release | ||
- cargo_publish_dry_run | ||
if: startsWith(github.event.ref, 'refs/tags/v') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install libudev-dev | ||
run: sudo apt-get update && sudo apt-get install libudev-dev | ||
- name: Cache Rust dependencies | ||
uses: actions/[email protected] | ||
with: | ||
path: target | ||
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.OS }}-build- | ||
- name: Install latest Rust nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
components: rustc, cargo | ||
toolchain: nightly | ||
override: true | ||
- name: Publish to Crates.io | ||
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,13 @@ | |
name = "litra" | ||
version = "0.2.1" | ||
edition = "2021" | ||
authors = ["Tim Rogers <[email protected]>"] | ||
description = "Control your Logitech Litra light from the command line" | ||
repository = "https://github.com/timrogers/litra-rs" | ||
license = "MIT" | ||
readme = "README.md" | ||
categories = ["hardware-support", "command-line-utilities"] | ||
keywords = ["logitech", "litra", "glow", "beam", "light"] | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
|
Oops, something went wrong.