diff --git a/Dockerfile b/Dockerfile index 72f7829..5a1440e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,5 @@ FROM composer:latest -RUN composer global require laravel/pint --no-progress --dev -ENV PATH="/tmp/vendor/bin:${PATH}" - COPY "entrypoint.sh" "/entrypoint.sh" RUN chmod +x /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml index c5d7596..4ff1743 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,10 @@ inputs: preset: description: "pint preset" required: false + + pintVersion: + description: "larave/pint composer version to install a specific version." + required: false runs: using: 'docker' image: 'Dockerfile' @@ -25,6 +29,7 @@ runs: - ${{ inputs.verbose-mode }} - ${{ inputs.config-path }} - ${{ inputs.preset }} + - ${{ inputs.pint-version }} branding: icon: 'eye' - color: 'gray-dark' \ No newline at end of file + color: 'gray-dark' diff --git a/entrypoint.sh b/entrypoint.sh index 118947c..a8f0cbb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,24 +1,38 @@ #!/bin/bash set -e -command_string=("pint") +pint_install_command=("composer global require laravel/pint:PINT_VERSION --no-progress --dev") + +if [[ "${INPUT_PINTVERSION}" ]] +then + pint_install_command="${pint_install_command/PINT_VERSION/${INPUT_PINTVERSION}}" +else + pint_install_command="${pint_install_command/:PINT_VERSION/}" +fi + +pint_command=("pint") if [[ "${INPUT_TESTMODE}" ]]; then - command_string+=" --test" + pint_command+=" --test" fi if [[ "${INPUT_VERBOSEMODE}" ]]; then - command_string+=" -v" + pint_command+=" -v" fi if [[ "${INPUT_CONFIGPATH}" ]]; then - command_string+=" --config ${INPUT_CONFIGPATH}" + pint_command+=" --config ${INPUT_CONFIGPATH}" fi if [[ "${INPUT_PRESET}" ]]; then - command_string+=" --preset ${INPUT_PRESET}" + pint_command+=" --preset ${INPUT_PRESET}" fi -echo "Running Command: " "${command_string[@]}" +echo "Running Command: " "${pint_install_command[@]}" + +${pint_install_command[@]} +PATH="/tmp/vendor/bin:${PATH}" + +echo "Running Command: " "${pint_command[@]}" -${command_string[@]} \ No newline at end of file +${pint_command[@]}