-
-
Notifications
You must be signed in to change notification settings - Fork 89
/
orb.yml
67 lines (64 loc) · 2.34 KB
/
orb.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
65
66
67
version: 2.1
description: "orb for ecspresso"
commands:
install:
description: "install ecspresso"
parameters:
version:
description: ecspresso version
type: string
default: latest
version-file:
description: "File containing the ecspresso version. Example: .ecspresso-version"
type: string
default: ""
os:
description: "OS of the binary. Example: linux, darwin, windows"
type: string
default: "linux"
arch:
description: "Architecture of the binary. Example: amd64, arm64"
type: string
default: "amd64"
steps:
- run:
name: "Install ecspresso"
shell: bash
command: |
VERSION="<< parameters.version >>"
if [ -n "<< parameters.version-file >>" ]; then
VERSION="v$(cat << parameters.version-file >>)"
fi
DOWNLOAD_OS="<< parameters.os >>"
DOWNLOAD_ARCH="<< parameters.arch >>"
if [ "${VERSION}" = "latest" ]; then
DOWNLOAD_URL=$(curl -sS https://api.github.com/repos/kayac/ecspresso/releases | jq --arg arch ${DOWNLOAD_OS}.${DOWNLOAD_ARCH}. -r '[.[]|select(.tag_name > "v2.0")|select(.prerelease==false)][0].assets[].browser_download_url|select(match($arch))')
else
DOWNLOAD_URL=https://github.com/kayac/ecspresso/releases/download/${VERSION}/ecspresso_${VERSION:1}_${DOWNLOAD_OS}_${DOWNLOAD_ARCH}.tar.gz
fi
cd /tmp
curl -sfLO ${DOWNLOAD_URL}
if [[ "${DOWNLOAD_URL}" =~ \.tar\.gz$ ]]; then
FILENAME=$(basename $DOWNLOAD_URL .tar.gz)
tar xzvf ${FILENAME}.tar.gz
sudo install ecspresso /usr/local/bin/ecspresso
elif [[ "${DOWNLOAD_URL}" =~ \.zip$ ]]; then
FILENAME=$(basename $DOWNLOAD_URL .zip)
unzip ${FILENAME}.zip
sudo install ${FILENAME} /usr/local/bin/ecspresso
fi
examples:
install_ecspresso:
description: Easily install ecspresso command
usage:
version: 2.1
orbs:
ecspresso: fujiwara/[email protected]
jobs:
ecspresso_example:
steps:
- checkout
- ecspresso/install
- run:
command: |
ecspresso deploy --config ecspresso.yml