Skip to content

Commit 05351ae

Browse files
authored
call to identify_collection action when collection_path and/or tar_file are not deffined (#91)
1 parent 4eb390a commit 05351ae

File tree

1 file changed

+22
-6
lines changed
  • .github/actions/build_install_collection

1 file changed

+22
-6
lines changed

.github/actions/build_install_collection/action.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,20 @@ inputs:
99
description: "Path to the collection source"
1010
required: true
1111
collection_path:
12-
description: The final collection path
13-
required: true
12+
description: |
13+
The final collection path
14+
If not set, this will be determined by the action
15+
default: ""
1416
tar_file:
15-
description: The collection tarball when built
16-
required: true
17+
description: |
18+
The collection tarball when built
19+
If not set, this will be determined by the action
20+
default: ""
21+
22+
outputs:
23+
collection_path:
24+
description: The final collection path
25+
value: ${{ inputs.collection_path || steps.identify.outputs.collection_path }}
1726

1827
runs:
1928
using: composite
@@ -57,17 +66,24 @@ runs:
5766
shell: bash
5867
working-directory: ${{ inputs.source_path }}
5968

69+
- name: identify collection (final installation path and tarball name)
70+
id: identify
71+
uses: ansible-network/github_actions/.github/actions/identify_collection@main
72+
with:
73+
source_path: ${{ inputs.source_path }}
74+
if: ${{ (inputs.collection_path == '') || (inputs.tar_file == '') }}
75+
6076
- name: Build collection
6177
run: ansible-galaxy collection build -vvv
6278
shell: bash
6379
working-directory: ${{ inputs.source_path }}
6480

6581
- name: Install collection and dependencies
66-
run: ansible-galaxy collection install ./${{ inputs.tar_file }} -p /home/runner/collections
82+
run: ansible-galaxy collection install ./${{ steps.identify.outputs.tar_file || inputs.tar_file }} -p /home/runner/collections
6783
shell: bash
6884
working-directory: ${{ inputs.source_path }}
6985

7086
- name: Copy the galaxy.yml from source to destination, needed for pytest-ansible-units
71-
run: cp galaxy.yml ${{ inputs.collection_path }}/galaxy.yml
87+
run: cp galaxy.yml ${{ steps.identify.outputs.collection_path || inputs.collection_path }}/galaxy.yml
7288
shell: bash
7389
working-directory: ${{ inputs.source_path }}

0 commit comments

Comments
 (0)