-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathaction.yml
More file actions
40 lines (40 loc) · 1.35 KB
/
action.yml
File metadata and controls
40 lines (40 loc) · 1.35 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
38
39
40
name: 'Install binary'
description: 'Install binaries from the stellar/binaries repo'
inputs:
name:
required: true
version:
required: true
ref:
required: false
runs:
using: "composite"
steps:
- name: Determine Install Path
shell: bash
run: |
# Tools beginning with 'cargo-' are intended to be used as a plugin for
# cargo. For some reason in GitHub Actions Window's runners cargo only
# finds plugins installed in the .cargo/bin directory, and not other bin
# directories even if they are located on the path.
if [[ "${{ inputs.name }}" == cargo-* ]]; then
echo "INSTALL_PATH=$HOME/.cargo/bin" >> $GITHUB_ENV
else
echo "INSTALL_PATH=$HOME/.local/bin" >> $GITHUB_ENV
fi
- name: Setup Install Location
shell: bash
run: |
mkdir -p $INSTALL_PATH
echo "$INSTALL_PATH" >> $GITHUB_PATH
- shell: bash
env:
REF: ${{ github.action_ref }}
run: |
file="${{ inputs.name }}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}.tar.gz"
ref="${{ inputs.ref || env.REF }}"
url="https://github.com/stellar/binaries/releases/download/$ref/$file"
temp_file="$RUNNER_TEMP/$(basename "$file")"
curl --retry 5 --retry-all-errors --retry-delay 2 -fL -o "$temp_file" "$url"
tar xvz -C "$INSTALL_PATH" -f "$temp_file"
rm -f "$temp_file"