Skip to content

Commit 0e1c1a0

Browse files
committedJan 20, 2025
Handle customed deployment command
1 parent 748a282 commit 0e1c1a0

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed
 

‎action.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ inputs:
1414
description: 'Endpoint of your Docker instance (xxxxxx.stackhero-network.com or your customized domain)'
1515
required: true
1616

17-
dockerComposeFile:
18-
description: 'Docker Compose file (e.g. "docker-compose.yml" or "docker/docker-compose.yml")'
17+
deployment_command:
18+
description: 'Command to run on deployment. This is useful to customize the Docker Compose command.'
1919
required: false
20-
default: 'docker-compose.yml'
2120

2221
runs:
2322
using: "composite"
@@ -69,9 +68,14 @@ runs:
6968
git fetch --unshallow origin
7069
printenv > env.list
7170
docker context use ${{ inputs.endpoint }}
72-
if [ ! -f "${{ inputs.dockerComposeFile }}"" ]
71+
if [ "${{ inputs.deployment_command }}" = "" ]
7372
then
74-
echo "::error::Can't find the Docker Compose file \"${{ inputs.dockerComposeFile }}\"."
75-
exit 1
76-
fi
77-
docker compose --env-file env.list --file ${{ inputs.dockerComposeFile }} up -d
73+
if [ ! -f "docker-compose.yml" ]
74+
then
75+
echo "::error::The \"docker-compose.yml\" file doesn't exist. You should ensure this file is at the root of your repository. If this file is in another directory, you should consider using the \"deployment_command\" input to customize the deployment command. You'll find more informations on Stackhero's documentation."
76+
exit 1
77+
fi
78+
docker compose --env-file env.list up -d
79+
else
80+
eval "${{ inputs.deployment_command }}"
81+
fi

0 commit comments

Comments
 (0)