-
Notifications
You must be signed in to change notification settings - Fork 5
/
action.yml
80 lines (69 loc) · 2.21 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: 'Setup Linode CLI'
description: 'Install the Linode CLI in a GitHub Actions environment.'
author: 'Akamai <[email protected]>'
branding:
icon: 'server'
color: 'orange'
inputs:
token:
description: 'The Linode API Personal Access Token to authenticate with.'
version:
description: 'The Linode CLI version to install.'
default: latest
optional-deps:
description: 'Whether optional Linode CLI dependencies should be installed.'
default: false
setup-python:
description: 'If true, Python will automatically be installed on the runner.'
default: true
upgrade:
description: 'If true, Linode CLI and its dependencies will be automatically upgraded. (--upgrade)'
default: true
runs:
using: 'composite'
steps:
- name: Mask the input token
shell: bash
run: echo "::add-mask::${{ inputs.token }}"
- name: Setup Python 3
uses: actions/setup-python@v5
if: ${{ inputs.setup-python == 'true' }}
with:
python-version: '3.x'
- name: Determine CLI install arguments
id: determine_install_args
shell: bash
run: |
# Compute extension
EXTENSION=""
if [ "$OPTIONAL_DEPS" == "true" ]
then
EXTENSION="[obj]"
fi
if [ "$VERSION" != "latest" ]
then
EXTENSION="${EXTENSION}==${VERSION}"
fi
echo "version_extension=${EXTENSION}" >> $GITHUB_ENV
# Compute args
ARGS=""
if [ "$UPGRADE" == "true" ]
then
ARGS="${ARGS}--upgrade "
fi
echo "pip_args=${ARGS}" >> $GITHUB_ENV
env:
VERSION: ${{ inputs.version }}
OPTIONAL_DEPS: ${{ inputs.optional-deps }}
UPGRADE: ${{ inputs.upgrade }}
- name: Install the Linode CLI
run: pip3 install ${{ env.pip_args }}linode-cli${{ env.version_extension }}
shell: bash
- name: Expose the Linode Token to the runner environment
if: ${{ inputs.token != '' }}
shell: bash
run: echo "LINODE_CLI_TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV"
- name: Validate the CLI is installed
if: ${{ inputs.token != '' }}
run: linode-cli --version
shell: bash