Skip to content

Commit

Permalink
Merge pull request #5 from DefangLabs/edw-add-behavior
Browse files Browse the repository at this point in the history
Add behavior param
  • Loading branch information
lionello authored Aug 20, 2024
2 parents 1a587a0 + d3b2e42 commit 77495c4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,28 @@ jobs:

- name: Deploy
uses: ./
continue-on-error: true # Ignore dry run error
with:
cli-version: v0.5.38
cli-version: v0.5.40
config-env-vars: "DEFANG_GH_ACTION_TEST_MESSAGE"
cwd: "./test"
compose-files: "compose.yaml compose.prod.yaml"
behavior: "staging"
env:
DEFANG_GH_ACTION_TEST_MESSAGE: ${{ secrets.MESSAGE }}
DEFANG_INTERNAL_TEST: dfng-test

- name: Deploy-Empty-Params
uses: ./
continue-on-error: true # Ignore dry run error
with:
cli-version: v0.5.40
config-env-vars: ""
cwd: "./test"
compose-files: ""
behavior: ""
env:
DEFANG_INTERNAL_TEST: dfng-test

- name: Teardown
run: defang config rm DEFANG_GH_ACTION_TEST_MESSAGE
13 changes: 11 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ inputs:
description: "The compose files to deploy. Format 'file1 file2 file3'"
required: false
default: ""
behavior:
description: "The behavior of the deployment. Options: 'development', 'staging', 'production'"
required: false
default: "development"

runs:
using: "composite"
Expand Down Expand Up @@ -53,9 +57,14 @@ runs:
params+=("-f")
params+=("$filename")
done
if [[ -n "${{ inputs['behavior'] }}" ]]; then
params+=("--behavior=${{ inputs['behavior'] }}")
fi
if [[ "${DEFANG_INTERNAL_TEST}" == "dfng-test" ]]; then
echo defang compose "${params[@]}" config
defang compose "${params[@]}" config
# `defang compose up --dry-run` is used for testing as --behavior flag is only available to the "compose up" command
echo defang compose "${params[@]}" up --dry-run
defang compose "${params[@]}" up --dry-run
else
echo defang compose "${params[@]}" up
defang compose "${params[@]}" up
Expand Down

0 comments on commit 77495c4

Please sign in to comment.