Skip to content

Commit

Permalink
Merge pull request #103 from vakaman/add-app-folder
Browse files Browse the repository at this point in the history
Add app folder
  • Loading branch information
g105b authored Aug 31, 2023
2 parents 3cfffbd + 1d79c12 commit 2ec65b6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Any arbitrary arguments can be passed to composer by using the `args` input, how
+ `php_version` - Choose which version of PHP you want to use - x.y (default `latest`) (e.g. `7.4.29`, 8.2`, or any version listed on https://www.php.net/releases/index.php)
+ `version` - Choose which version of Composer you want to use - default `latest` (e.g. `1.x`, `1.10.26`, `2.x`, `2.2.x`, or any exact version listed on https://getcomposer.org/download/)
+ `memory_limit` - Sets the composer memory limit - (default _empty_)
+ `container_workdir` - Sets the aplication workdir inside container - (default /app)

There are also SSH input available: `ssh_key`, `ssh_key_pub` and `ssh_domain` that are used for depending on private repositories. See below for more information on usage.

Expand Down Expand Up @@ -113,6 +114,20 @@ jobs:
version: 1
```

Execute composer install in a different folder
-------------------------------------------

```yaml
- name: Install dependencies
uses: "php-actions/composer@v6"
env:
COMPOSER: "composer.json"
with:
php_version: "5.6.40"
version: "2.2"
args: "--ignore-platform-reqs --optimize-autoloader"
working_dir: "my/different/folder"
```

Including PHP Extensions
-------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ inputs:
description: "Sets the composer memory limit"
required: false

container_workdir:
description: "Sets the aplication workdir inside container"
required: false

outputs:
full_command:
description: "The full command passed to docker to run"
Expand All @@ -99,6 +103,7 @@ runs:
ACTION_SSH_PORT: ${{ inputs.ssh_port }}
ACTION_WORKING_DIR: ${{ inputs.working_dir }}
ACTION_MEMORY_LIMIT: ${{ inputs.memory_limit }}
ACTION_CONTAINER_WORKDIR: ${{ inputs.container_workdir }}
id: composer_run
run: |
set -e
Expand Down
8 changes: 7 additions & 1 deletion composer-action.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash
set -e

container_workdir="/app"
github_action_path=$(dirname "$0")
docker_tag=$(cat ./docker_tag)
echo "Docker tag: $docker_tag" >> output.log 2>&1
Expand Down Expand Up @@ -194,6 +196,10 @@ do
fi
done <<<$(env)

if [ -z "$ACTION_CONTAINER_WORKDIR" ]; then
container_workdir="${ACTION_CONTAINER_WORKDIR}"
fi

echo "name=full_command::${command_string}" >> $GITHUB_OUTPUT

docker run --rm \
Expand All @@ -202,7 +208,7 @@ docker run --rm \
--volume ~/.ssh:/root/.ssh \
--volume "${GITHUB_WORKSPACE}":/app \
--volume "/tmp/composer-cache":/tmp/composer-cache \
--workdir /app \
--workdir ${container_workdir} \
--env-file ./DOCKER_ENV \
--network host \
${memory_limit} \
Expand Down

0 comments on commit 2ec65b6

Please sign in to comment.