-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
87 lines (79 loc) · 2.1 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
81
82
83
84
85
86
87
name: 'StackSpot Run Command'
description: 'GitHub Action to run CLI Command'
branding:
icon: 'arrow-up-circle'
color: 'orange'
inputs:
client_id:
description: Account client id
required: true
client_key:
description: Account client key
required: true
realm:
description: Account realm
required: true
command_stk:
description: Command STK
required: false
default: ''
working_directory:
description: Working directory
required: false
default: '.'
runs:
using: "composite"
steps:
- name: Check if STK CLI Installed
id: check_cli
shell: bash
run: |
if [ -f "$HOME/.stk/bin/stk" ]; then
echo "STK_INSTALLED=true" >> "$GITHUB_ENV"
else
echo "STK_INSTALLED=false" >> "$GITHUB_ENV"
fi
- name: Install STK CLI
if: env.STK_INSTALLED == 'false'
shell: bash
run: |
curl \
--fail \
--http2-prior-knowledge \
--location \
--silent \
--show-error \
--tlsv1.3 \
https://stk.stackspot.com/install.sh | bash
- name: Check if STK CLI Installed
id: check_cli2
shell: bash
run: |
if [ -f "$HOME/.stk/bin/stk" ]; then
echo "STK_INSTALLED=true" >> "$GITHUB_ENV"
echo "PATH=$PATH:$HOME/.stk/bin" >> "$GITHUB_ENV"
else
echo "STK_INSTALLED=false" >> "$GITHUB_ENV"
fi
- name: Show STK CLI version
shell: bash
run: stk --version
- name: Login StackSpot
shell: bash
env:
CLIENT_ID: ${{ inputs.client_id }}
CLIENT_KEY: ${{ inputs.client_key }}
REALM: ${{ inputs.realm }}
run: |
stk login --client-id $CLIENT_ID --client-key $CLIENT_KEY --realm $REALM
- name: Run Command
shell: bash
run: |
cd ${{ inputs.working_directory }}
stk ${{ inputs.command_stk }}
- name: Show Error Log
shell: bash
if: ${{ failure() }}
run: |
[ -d "$HOME/.stk/logs/" ] && [ "$(ls -A $HOME/.stk/logs/)" ] && cat $HOME/.stk/logs/*
exit 1