Skip to content

Commit

Permalink
Add multiple file support (#4)
Browse files Browse the repository at this point in the history
* Add multiple file support

* Fix -f parameter position

---------

Co-authored-by: Edward J <[email protected]>
  • Loading branch information
edwardrf and edw-defang committed Aug 16, 2024
1 parent 0de3045 commit 1a587a0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ jobs:
uses: actions/checkout@v4

- name: Deploy
uses: DefangLabs/[email protected]
uses: ./
with:
cli-version: v0.5.38
config-env-vars: "DEFANG_GH_ACTION_TEST_MESSAGE"
cwd: "./test"
compose-files: "compose.yaml compose.prod.yaml"
env:
DEFANG_GH_ACTION_TEST_MESSAGE: ${{ secrets.MESSAGE }}
DEFANG_INTERNAL_TEST: dfng-test

- name: Teardown
run: defang config rm DEFANG_GH_ACTION_TEST_MESSAGE
run: defang config rm DEFANG_GH_ACTION_TEST_MESSAGE
15 changes: 13 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ inputs:
description: "The directory containing the compose file to deploy."
required: false
default: "."
compose-files:
description: "The compose files to deploy. Format 'file1 file2 file3'"
required: false
default: ""

runs:
using: "composite"
Expand All @@ -44,9 +48,16 @@ runs:
- name: Execute
shell: bash
run: |
params=()
for filename in ${{ inputs['compose-files'] }}; do
params+=("-f")
params+=("$filename")
done
if [[ "${DEFANG_INTERNAL_TEST}" == "dfng-test" ]]; then
defang compose config
echo defang compose "${params[@]}" config
defang compose "${params[@]}" config
else
defang compose up
echo defang compose "${params[@]}" up
defang compose "${params[@]}" up
fi
working-directory: ${{ inputs.cwd }}
4 changes: 4 additions & 0 deletions test/compose.prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
web:
environment:
DEFANG_GH_ACTION_TEST_MESSAGE:
1 change: 0 additions & 1 deletion test/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ services:
- "3000:3000"
environment:
PORT: 3000
DEFANG_GH_ACTION_TEST_MESSAGE:

0 comments on commit 1a587a0

Please sign in to comment.