From b35d3b88b86a799e73e21f98cfb6eaa7b7639c13 Mon Sep 17 00:00:00 2001 From: Cliffano Subagio Date: Sun, 28 Jul 2024 12:22:22 +1000 Subject: [PATCH] Use if condition on docker run command since one-liner doesn't work. --- action.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9536f2a..7c694c3 100644 --- a/action.yml +++ b/action.yml @@ -37,7 +37,16 @@ runs: shell: sh run: | cd $GITHUB_ACTION_PATH && docker build -f Dockerfile --build-arg IMAGE=${{ inputs.image }} --build-arg SHELL=${{ inputs.shell }} -t local_image:8.8.8 . + - name: Deploy on pushes + + run: echo 'DEPLOY=true' >> "$GITHUB_ENV" - name: Run Docker container on the GitHub Workspace directory + if: inputs.env_file == '' shell: sh run: | - cd $GITHUB_WORKSPACE && docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v .:/opt/workspace/ ${{ inputs.env_file != '' && '--env-file' }} "${{ inputs.env_file }}" --name local_container local_image:8.8.8 "${{ inputs.command }}" + cd $GITHUB_WORKSPACE && docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v .:/opt/workspace/ --name local_container local_image:8.8.8 "${{ inputs.command }}" + - name: Run Docker container on the GitHub Workspace directory with env file + if: inputs.env_file != '' + shell: sh + run: | + cd $GITHUB_WORKSPACE && docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v .:/opt/workspace/ --env-file "${{ inputs.env_file }}" --name local_container local_image:8.8.8 "${{ inputs.command }}"