Skip to content

Commit 1a587a0

Browse files
edwardrfedw-defang
andauthored
Add multiple file support (#4)
* Add multiple file support * Fix -f parameter position --------- Co-authored-by: Edward J <[email protected]>
1 parent 0de3045 commit 1a587a0

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

.github/workflows/test.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ jobs:
2323
uses: actions/checkout@v4
2424

2525
- name: Deploy
26-
uses: DefangLabs/[email protected]
26+
uses: ./
2727
with:
2828
cli-version: v0.5.38
2929
config-env-vars: "DEFANG_GH_ACTION_TEST_MESSAGE"
3030
cwd: "./test"
31+
compose-files: "compose.yaml compose.prod.yaml"
3132
env:
3233
DEFANG_GH_ACTION_TEST_MESSAGE: ${{ secrets.MESSAGE }}
3334
DEFANG_INTERNAL_TEST: dfng-test
3435

3536
- name: Teardown
36-
run: defang config rm DEFANG_GH_ACTION_TEST_MESSAGE
37+
run: defang config rm DEFANG_GH_ACTION_TEST_MESSAGE

action.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ inputs:
1818
description: "The directory containing the compose file to deploy."
1919
required: false
2020
default: "."
21+
compose-files:
22+
description: "The compose files to deploy. Format 'file1 file2 file3'"
23+
required: false
24+
default: ""
2125

2226
runs:
2327
using: "composite"
@@ -44,9 +48,16 @@ runs:
4448
- name: Execute
4549
shell: bash
4650
run: |
51+
params=()
52+
for filename in ${{ inputs['compose-files'] }}; do
53+
params+=("-f")
54+
params+=("$filename")
55+
done
4756
if [[ "${DEFANG_INTERNAL_TEST}" == "dfng-test" ]]; then
48-
defang compose config
57+
echo defang compose "${params[@]}" config
58+
defang compose "${params[@]}" config
4959
else
50-
defang compose up
60+
echo defang compose "${params[@]}" up
61+
defang compose "${params[@]}" up
5162
fi
5263
working-directory: ${{ inputs.cwd }}

test/compose.prod.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
services:
2+
web:
3+
environment:
4+
DEFANG_GH_ACTION_TEST_MESSAGE:

test/compose.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ services:
55
- "3000:3000"
66
environment:
77
PORT: 3000
8-
DEFANG_GH_ACTION_TEST_MESSAGE:

0 commit comments

Comments
 (0)