3
0
Fork 0
mirror of https://github.com/dtolnay/install.git synced 2024-11-21 16:09:32 +01:00
cargo-install/action.yml
2022-10-13 09:35:44 -07:00

32 lines
1.6 KiB
YAML

name: cargo install
author: David Tolnay
description: Fast `cargo install` action using a GitHub-based binary cache
inputs:
crate:
description: Name of crate as published to crates.io
required: true
bin:
description: Name of binary; default = same as crate name
required: false
runs:
using: composite
steps:
- name: Determine cargo bin directory
run: echo "dir=$(dirname $(which cargo))" >> $GITHUB_OUTPUT
shell: bash
id: cargo
- name: Download ${{inputs.bin || inputs.crate}}
run: curl --output ${{steps.cargo.outputs.dir}}/${{inputs.bin || inputs.crate}} https://github.com/dtolnay/install/releases/download/${{inputs.crate}}/${{inputs.bin || inputs.crate}} --location --silent --show-error --fail --retry 5
shell: bash
- name: Download ${{inputs.bin || inputs.crate}}.sig
run: curl --output ${{runner.temp}}/${{inputs.bin || inputs.crate}}.sig https://github.com/dtolnay/install/releases/download/${{inputs.crate}}/${{inputs.bin || inputs.crate}}.sig --location --silent --show-error --fail --retry 5
shell: bash
- name: Retrieve public key of signing key
run: gpg --output ${{runner.temp}}/signing-key.gpg --yes --dearmor ${{github.action_path}}/signing-key.asc
shell: bash
- name: Verify gpg signature
run: gpg --no-default-keyring --keyring ${{runner.temp}}/signing-key.gpg --trusted-key 830334D6A6010C41 --verify ${{runner.temp}}/${{inputs.bin || inputs.crate}}.sig ${{steps.cargo.outputs.dir}}/${{inputs.bin || inputs.crate}}
shell: bash
- name: Set executable bit
run: chmod +x ${{steps.cargo.outputs.dir}}/${{inputs.bin || inputs.crate}}
shell: bash