-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
58 lines (51 loc) · 1.6 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
name: 'Extract image list'
description: 'Extract a list of Docker images from a source file (Kubernetes manifests or Docker Compose)'
inputs:
input-file:
description: Path to input file or folder
required: true
add-java:
description: If Java should be added - required to run Groovy script
# FIXME rather run in Docker?
default: 'false'
add-images:
description: Additional images to add to the result (Json array)
default: ''
outputs:
images:
description: List of images (Json array)
value: ${{ steps.extract.outputs.images }}
runs:
using: "composite"
steps:
- name: Install Java
if: ${{ inputs.add-java == 'true' }}
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
distribution: 'temurin'
java-version: '17'
- name: Install Groovy
run: |
sudo apt-get update && sudo apt-get install -y groovy
shell: bash
- name: Add action folder to path
run: echo "${{ github.action_path }}" >> $GITHUB_PATH
shell: bash
- name: Write file with additional images
if: ${{ inputs.add-images != '' }}
run: |
cat <<EOF > extract_add_images.json
${{ inputs.add-images }}
EOF
shell: bash
- name: Extract Images
id: extract
run: |
extract.groovy ${{ inputs.input-file }} images.json extract_add_images.json
IMAGES=$(<images.json)
echo "images=$(echo $IMAGES)" >> $GITHUB_OUTPUT
shell: bash
- name: Display output
run: |
echo "Images: ${{ steps.extract.outputs.images }}"
shell: bash