-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
55 lines (49 loc) · 1.55 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
name: Setup Consul Template CLI
description: Downloads and move consul-template binary to the /usr/local/bin/ directory
branding:
icon: check
color: blue
inputs:
version:
description: Consul Template version to install
required: false
default: 0.27.0
runs:
using: composite
steps:
- name: Export vars
shell: bash
id: vars
env:
RUNNER_OS: ${{ runner.os }}
VERSION: ${{ inputs.version }}
run: |
OS=$(echo "$RUNNER_OS" | tr "[:upper:]" "[:lower:]")
if [ $OS == "macos" ]; then
ARCHITECTURE="darwin_amd64"
elif [ $OS == "linux" ]; then
ARCHITECTURE="linux_amd64"
else
echo "$RUNNER_OS is not supported yet"
exit 1
fi
echo "::set-output name=zip-filename::consul-template_$(echo "$VERSION")_$ARCHITECTURE.zip"
- name: Download .zip from Hashicorp CDN
shell: bash
env:
VERSION: ${{ inputs.version }}
ZIP_FILENAME: ${{ steps.vars.outputs.zip-filename }}
run: wget https://releases.hashicorp.com/consul-template/$VERSION/$ZIP_FILENAME
- name: Extract .zip file
shell: bash
env:
ZIP_FILENAME: ${{ steps.vars.outputs.zip-filename }}
run: unzip $ZIP_FILENAME
- name: Move consul-template binary to /usr/local/bin directory
run: sudo mv consul-template /usr/local/bin/consul-template
shell: bash
- name: Remove residual files
shell: bash
env:
ZIP_FILENAME: ${{ steps.vars.outputs.zip-filename }}
run: rm -rf $ZIP_FILENAME