Skip to content
Open
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
fetch-depth: 1
- name: Start Deployment
uses: wshihadeh/docker-deployment-action@master
uses: gonzalochief/docker-deployment-action@master

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you change this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test the fork

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please reset this and push it again?

with:
remote_docker_host: ${{ secrets.HOST }}
ssh_private_key: ${{ secrets.PRIVATE_KEY }}
Expand All @@ -29,7 +29,7 @@ jobs:
args: -p test up -d

- name: Start Deployment without copy
uses: wshihadeh/docker-deployment-action@master
uses: gonzalochief/docker-deployment-action@master

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To test the fork

with:
remote_docker_host: ${{ secrets.HOST }}
ssh_private_key: ${{ secrets.PRIVATE_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Below is a brief example on how the action can be used:

```yaml
- name: Deploy to Docker swarm
uses: wshihadeh/docker-deployment-action@v1
uses: gonzalochief/docker-deployment-action@v1
with:
remote_docker_host: [email protected]
ssh_private_key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }}
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ inputs:
deployment_mode:
description: Deployment mode either docker-swarm or docker-compose. Default is docker-compose.
required: false
docker_compose_ver:
description: Docker-compose version. Default is v2.
required: false
copy_stack_file:
description: Copy stack file to remote server and deploy from the server. Default is false.
required: false
Expand Down
14 changes: 12 additions & 2 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ fi

STACK_FILE=${INPUT_STACK_FILE_NAME}
DEPLOYMENT_COMMAND_OPTIONS=""
DOCKER_COMP_COMMAND=""


if [ "$INPUT_COPY_STACK_FILE" == "true" ]; then
Expand All @@ -57,6 +58,15 @@ else
DEPLOYMENT_COMMAND_OPTIONS=" --log-level debug --host ssh://$INPUT_REMOTE_DOCKER_HOST:$INPUT_REMOTE_DOCKER_PORT"
fi

if [ "$INPUT_DEPLOYMENT_MODE" == "docker-compose" ] && [ "$INPUT_DOCKER_COMPOSE_VER" == "v2" ]; then
DOCKER_COMP_COMMAND="docker compose"
elif [ "$INPUT_DEPLOYMENT_MODE" == "docker-compose" ] && [ "$INPUT_DOCKER_COMPOSE_VER" == "v1" ]; then
DOCKER_COMP_COMMAND="docker-compose"
else
DOCKER_COMP_COMMAND="docker compose"
fi


Comment on lines +61 to +69

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [ "$INPUT_DEPLOYMENT_MODE" == "docker-compose" ] && [ "$INPUT_DOCKER_COMPOSE_VER" == "v2" ]; then
DOCKER_COMP_COMMAND="docker compose"
elif [ "$INPUT_DEPLOYMENT_MODE" == "docker-compose" ] && [ "$INPUT_DOCKER_COMPOSE_VER" == "v1" ]; then
DOCKER_COMP_COMMAND="docker-compose"
else
DOCKER_COMP_COMMAND="docker compose"
fi
DOCKER_COMP_COMMAND="docker compose"
if [ "$INPUT_DEPLOYMENT_MODE" == "docker-compose" ] && [ "$INPUT_DOCKER_COMPOSE_VER" == "v1" ]; then
DOCKER_COMP_COMMAND="docker-compose"
fi

case $INPUT_DEPLOYMENT_MODE in

docker-swarm)
Expand All @@ -65,7 +75,7 @@ case $INPUT_DEPLOYMENT_MODE in

*)
INPUT_DEPLOYMENT_MODE="docker-compose"
DEPLOYMENT_COMMAND="docker-compose $DEPLOYMENT_COMMAND_OPTIONS -f $STACK_FILE"
DEPLOYMENT_COMMAND="$DOCKER_COMP_COMMAND $DEPLOYMENT_COMMAND_OPTIONS -f $STACK_FILE"
;;
esac

Expand Down Expand Up @@ -102,7 +112,7 @@ if ! [ -z "$INPUT_COPY_STACK_FILE" ] && [ $INPUT_COPY_STACK_FILE = 'true' ] ; th
execute_ssh "ls -t $INPUT_DEPLOY_PATH/stacks/docker-stack-* 2>/dev/null | tail -n +$INPUT_KEEP_FILES | xargs rm -- 2>/dev/null || true"

if ! [ -z "$INPUT_PULL_IMAGES_FIRST" ] && [ $INPUT_PULL_IMAGES_FIRST = 'true' ] && [ $INPUT_DEPLOYMENT_MODE = 'docker-compose' ] ; then
execute_ssh "${DEPLOYMENT_COMMAND} pull"
execute_ssh ${DEPLOYMENT_COMMAND} "pull"
fi

if ! [ -z "$INPUT_PRE_DEPLOYMENT_COMMAND_ARGS" ] && [ $INPUT_DEPLOYMENT_MODE = 'docker-compose' ] ; then
Expand Down