-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
110 lines (90 loc) · 2.34 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
name: bindep
description: >-
GitHub Action for provisioning the software listed in `bindep.txt`
author: Sviatoslav Sydorenko <wk+~github.com/re-actors/[email protected]>
branding:
icon: terminal
color: gray-dark
inputs:
file:
default: bindep.txt
description: >-
`bindep.txt`-compliant file path
required: false
profile:
default: test
description: >-
`bindep` profile (default: `test`)
required: false
outputs:
packages:
description: List of the installed packages
value: ${{ steps.bindep.outputs.packages }}
runs:
using: composite
steps:
- name: Retrieve the packages from bindep.txt
id: bindep
run: >
echo ::group::Reading the deps for
'${{ inputs.profile }}' from '${{ inputs.file }}'...
set -x
PKGS=$( \
echo $( \
pipx run bindep \
-b \
-f '${{ inputs.file }}' \
${{ inputs.profile }} \
) \
)
if [[ 'Error reading file ${{ inputs.file }}.' == "${PKGS}" ]]
then
>&2 echo "It appears the ${{ inputs.file }} is missing" \
"${PKGS}" \
"Did you forget to fetch your repository onto the runner?"
exit 1
fi
echo "::set-output name=packages::${PKGS}"
set +x
echo ::endgroup::
shell: bash
- name: Log the packages
if: steps.bindep.outputs.packages
run: >
echo Missing bindep-required packages are:
${{ steps.bindep.outputs.packages }}
shell: bash
- name: Log the packages
if: >-
!steps.bindep.outputs.packages
run: >
echo bindep.txt profile '${{ inputs.profile }}' is fully satisfied.
Nothing to do.
shell: bash
- name: Install the packages from `bindep.txt`
if: steps.bindep.outputs.packages
run: >
echo ::group::Installing
'${{ steps.bindep.outputs.packages }}'
using Ansible...
PKGS=$( \
echo '${{ steps.bindep.outputs.packages }}' \
| \
sed 's#\(^\s\+\|\s\+$\)##g;s#\s#\,#g' \
)
set -x
ANSIBLE_CMD=$( \
command -v ansible \
|| \
echo pipx run --spec ansible-core ansible \
)
${ANSIBLE_CMD} localhost
-c local
--become
-m ansible.builtin.package
-a "name=${PKGS} state=present"
set +x
echo ::endgroup::
shell: bash
...