-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
72 lines (64 loc) · 2.19 KB
/
action.yml
File metadata and controls
72 lines (64 loc) · 2.19 KB
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
name: "Setup dpctl"
description: "Install the DeployPulse dpctl CLI"
author: "DeployPulse, LLC"
branding:
icon: "upload-cloud"
color: "blue"
inputs:
version:
description: "dpctl version to install (e.g., v1.0.0). Defaults to the latest npm release, or the latest commit on the main branch when source is 'git'."
required: false
default: "latest"
source:
description: "Defines the install source. Must be 'npm' or 'git'. Defaults to 'npm'."
required: false
default: "npm"
node-version:
description: "Defines which Node.js version to install. Recommended version is >=22."
required: false
default: "22"
runs:
using: "composite"
steps:
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}
- name: Install dpctl
shell: bash
run: |
set -euo pipefail
NPM_PKG="@deploypulseio/dpctl"
GIT_REPO="git+https://github.com/deploypulseio/dpctl.git"
# Ensure npm is available (either preinstalled or via setup-node)
command -v npm >/dev/null 2>&1 || {
echo "::error::npm not found. Please ensure Node.js is installed and available in PATH."
exit 1
}
# Validate source input (npm or git)
if [ "${{ inputs.source }}" != "npm" ] && [ "${{ inputs.source }}" != "git" ]; then
echo "::error::Invalid source '${{ inputs.source }}'. Must be 'npm' or 'git'."
exit 1
fi
if [ "${{ inputs.source }}" = "git" ]; then
if [ "${{ inputs.version }}" = "latest" ]; then
npm i -g "${GIT_REPO}"
else
npm i -g "${GIT_REPO}#${{ inputs.version }}"
fi
else
if [ "${{ inputs.version }}" = "latest" ]; then
npm i -g "${NPM_PKG}"
else
npm i -g "${NPM_PKG}@${{ inputs.version }}"
fi
fi
- name: Verify dpctl Installation
shell: bash
run: |
set -euo pipefail
command -v dpctl >/dev/null 2>&1 || {
echo "::error::dpctl not found in PATH after install."
exit 1
}
echo "::notice::dpctl version $(dpctl --version) installed successfully."