-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
59 lines (54 loc) · 1.34 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
name: "Setup bk"
author: "Buildkite"
description: "Install Buildkite CLI (bk)"
branding:
icon: terminal
color: green
runs:
# TODO: Convert to a JavaScript action which uses the tool cache, like:
# https://docs.github.com/en/actions/sharing-automations/creating-actions/developing-a-third-party-cli-action#example
using: "composite"
steps:
- shell: bash
run: |
set -ex
tag=$(curl -s -u "username:${{ github.token }}" https://api.github.com/repos/buildkite/cli/releases/latest | jq -r ".tag_name")
version=${tag#v}
case ${{ runner.os }} in
Linux)
os="linux"
ext="tar.gz"
out="bk"
;;
macOS)
os="macOS"
ext="zip"
out="bk"
;;
Windows)
os="windows"
ext="zip"
out="bk.exe"
;;
esac
case ${{ runner.arch }} in
X86)
arch=386
;;
X64)
arch=amd64
;;
ARM)
arch=armv6
;;
ARM64)
arch=arm64
;;
esac
echo "Installing bk @ ${tag} for ${os} on ${arch}"
tmp=$(mktemp -d)
cd ${tmp}
curl -fsSL https://github.com/buildkite/cli/releases/download/${tag}/bk_${version}_${os}_${arch}.${ext} | tar -xz --strip-components=1
chmod +x ${out}
PATH=${PATH}:${tmp}
echo "${tmp}" >> $GITHUB_PATH