Skip to content

Commit 77495c4

Browse files
authored
Merge pull request #5 from DefangLabs/edw-add-behavior
Add behavior param
2 parents 1a587a0 + d3b2e42 commit 77495c4

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

.github/workflows/test.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,28 @@ jobs:
2424

2525
- name: Deploy
2626
uses: ./
27+
continue-on-error: true # Ignore dry run error
2728
with:
28-
cli-version: v0.5.38
29+
cli-version: v0.5.40
2930
config-env-vars: "DEFANG_GH_ACTION_TEST_MESSAGE"
3031
cwd: "./test"
3132
compose-files: "compose.yaml compose.prod.yaml"
33+
behavior: "staging"
3234
env:
3335
DEFANG_GH_ACTION_TEST_MESSAGE: ${{ secrets.MESSAGE }}
3436
DEFANG_INTERNAL_TEST: dfng-test
3537

38+
- name: Deploy-Empty-Params
39+
uses: ./
40+
continue-on-error: true # Ignore dry run error
41+
with:
42+
cli-version: v0.5.40
43+
config-env-vars: ""
44+
cwd: "./test"
45+
compose-files: ""
46+
behavior: ""
47+
env:
48+
DEFANG_INTERNAL_TEST: dfng-test
49+
3650
- name: Teardown
3751
run: defang config rm DEFANG_GH_ACTION_TEST_MESSAGE

action.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ inputs:
2222
description: "The compose files to deploy. Format 'file1 file2 file3'"
2323
required: false
2424
default: ""
25+
behavior:
26+
description: "The behavior of the deployment. Options: 'development', 'staging', 'production'"
27+
required: false
28+
default: "development"
2529

2630
runs:
2731
using: "composite"
@@ -53,9 +57,14 @@ runs:
5357
params+=("-f")
5458
params+=("$filename")
5559
done
60+
if [[ -n "${{ inputs['behavior'] }}" ]]; then
61+
params+=("--behavior=${{ inputs['behavior'] }}")
62+
fi
63+
5664
if [[ "${DEFANG_INTERNAL_TEST}" == "dfng-test" ]]; then
57-
echo defang compose "${params[@]}" config
58-
defang compose "${params[@]}" config
65+
# `defang compose up --dry-run` is used for testing as --behavior flag is only available to the "compose up" command
66+
echo defang compose "${params[@]}" up --dry-run
67+
defang compose "${params[@]}" up --dry-run
5968
else
6069
echo defang compose "${params[@]}" up
6170
defang compose "${params[@]}" up

0 commit comments

Comments
 (0)