-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathaction.yml
More file actions
37 lines (37 loc) · 1.58 KB
/
action.yml
File metadata and controls
37 lines (37 loc) · 1.58 KB
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
37
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
github_token:
description: Access token for connecting to GitHub API for artifact attestation; normally the ephemeral {{github.token}} when used in a GitHub workflow, or a personal access token {{secrets.GH_TOKEN}} in Gitea's act runner
default: ${{github.token}}
runs:
using: composite
steps:
- name: Check inputs
run: |
echo "crate=${{inputs.crate}}" >> $GITHUB_OUTPUT
echo "bin=${{inputs.bin || inputs.crate}}" >> $GITHUB_OUTPUT
shell: bash
id: inputs
- name: Determine cargo bin directory
run: echo "dir=$(dirname $(which cargo))" >> $GITHUB_OUTPUT
shell: bash
id: cargo
- name: Download ${{steps.inputs.outputs.bin}}
run: curl --output ${{steps.cargo.outputs.dir}}/${{steps.inputs.outputs.bin}} https://github.com/dtolnay/install/releases/download/${{steps.inputs.outputs.crate}}/${{steps.inputs.outputs.bin}} --location --silent --show-error --fail --retry 5
shell: bash
- name: Verify artifact attestation
run: gh attestation verify --owner dtolnay ${{steps.cargo.outputs.dir}}/${{steps.inputs.outputs.bin}}
env:
GH_TOKEN: ${{inputs.github_token}}
shell: bash
- name: Set executable bit
run: chmod +x ${{steps.cargo.outputs.dir}}/${{steps.inputs.outputs.bin}}
shell: bash