forked from stellar/stellar-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
64 lines (64 loc) · 2.18 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: 'Install stellar-cli'
description: 'Install the stellar-cli'
inputs:
version:
description: |
Recommended for use only in testing new versions of the action prior to
release. For regular use, use the version of the action corresponding to
the version of the stellar-cli that should be installed.
required: false
runs:
using: "composite"
steps:
- name: Setup install path
shell: bash
run: |
mkdir -p $HOME/.local/bin
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Determine version to install
id: version
shell: bash
run: |
echo "version=${{ inputs.version || github.action_ref }}" >> "$GITHUB_OUTPUT"
- name: Copy binary to install location
shell: bash
run: |
version="${{ steps.version.outputs.version }}"
case "${{ runner.os }}-${{ runner.arch }}" in
'Linux-X64')
os_arch=x86_64-unknown-linux-gnu
;;
'Linux-ARM64')
os_arch=aarch64-unknown-linux-gnu
;;
'macOS-X64')
os_arch=x86_64-apple-darwin
;;
'macOS-ARM64')
os_arch=aarch64-apple-darwin
;;
'Windows-X64')
os_arch=x86_64-pc-windows-msvc
;;
*)
echo "Unsupported OS / Arch pair: ${{ runner.os }} ${{ runner.arch }}" >&2
exit 1
esac
file="stellar-cli-$version-$os_arch.tar.gz"
url="https://github.com/stellar/stellar-cli/releases/download/v$version/$file"
echo "$url"
curl -fL "$url" | tar xvz -C $HOME/.local/bin
- name: Verify binary against attestation
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
version="${{ steps.version.outputs.version }}"
subject="$(gh attestation verify ~/.local/bin/stellar --repo stellar/stellar-cli --format json -q '.[].verificationResult.signature.certificate.subjectAlternativeName')"
echo "Found subject: $subject" >&2
expected_subject="https://github.com/stellar/stellar-cli/.github/workflows/binaries.yml@refs/tags/v$version"
echo "Expected subject: $expected_subject" >&2
if [[ "$subject" != "$expected_subject" ]]; then
echo "Attestation verification found unexpected subject" >&2
exit 1
fi