forked from dtolnay/install
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
36 lines (36 loc) · 1.91 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: cargo install
author: Stackable
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 architecture
id: arch
shell: bash
run: echo "arch=$(arch)" >> $GITHUB_OUTPUT
- name: Determine cargo bin directory
run: echo "dir=$(dirname $(which cargo))" >> $GITHUB_OUTPUT
shell: bash
id: cargo
- name: Download ${{inputs.bin || inputs.crate}}-${{steps.arch.outputs.arch}}
run: curl --output ${{steps.cargo.outputs.dir}}/${{inputs.bin || inputs.crate}} https://github.com/stackabletech/cargo-install-action/releases/download/${{inputs.crate}}/${{inputs.bin || inputs.crate}}-${{steps.arch.outputs.arch}} --location --silent --show-error --fail --retry 5
shell: bash
- name: Download ${{inputs.bin || inputs.crate}}-${{steps.arch.outputs.arch}}.sig
run: curl --output ${{runner.temp}}/${{inputs.bin || inputs.crate}}.sig https://github.com/stackabletech/cargo-install-action/releases/download/${{inputs.crate}}/${{inputs.bin || inputs.crate}}-${{steps.arch.outputs.arch}}.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