googlefonts / fontc

Where in we pursue oxidizing (context: https://github.com/googlefonts/oxidize) fontmake.
Apache License 2.0
62 stars 10 forks source link

add support for cargo binstall in fontc/Cargo.toml #827

Closed anthrotype closed 1 month ago

anthrotype commented 1 month ago

there's this nice cargo sub-command called https://github.com/cargo-bins/cargo-binstall which allows one to install pre-compiled binaries for one's own platform/architecture that are hosted on Github Releases.

This is particularly useful e.g. for https://github.com/googlefonts/fontc-action where one would like to install fontc the quickest way possible instead of building from source.

Usually cargo binstall just works and it requires no configuation, but in our particular case, because we push prefixed tags like fontc-v{version} instead of bare v{version}, then cargo binstall cannot automatically find the github releases download URL, and falls back to the slower cargo install (from source).

This little change to fontc/Cargo.toml should make sure the correct URL will be used.

anthrotype commented 1 month ago

/cc @chrissimpkins

cmyr commented 1 month ago

is this testable in any way?

anthrotype commented 1 month ago

well, you could call cargo binstall from the command line overriding the same flags that I have changed in the manifest:

$ cargo binstall --pkg-url="{ repo }/releases/download/{ name }-v{ version }/{ name }-{ target }{ archive-suffix }" --bin-dir="{ bin }{ binary-ext }" --pkg-fmt="tgz" fontc@0.0.1
anthrotype commented 1 month ago

if we merge these changes and release them to crates.io, then for the new releases one will be able to simply use cargo binstall fontc or cargo binstall fontc@0.1.0 etc.