-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
action.yml
100 lines (92 loc) · 3.14 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: "Install PHP Dependencies with Composer"
author: "Ben Ramsey"
description: >-
Installs and caches PHP dependencies with Composer, accepting arguments to
configure how and what to install.
branding:
icon: download
color: purple
inputs:
dependency-versions:
description: >-
The version of dependencies to prefer (`lowest`, `highest`, or `locked`).
required: true
default: "locked"
composer-options:
description: >-
Additional options to pass to Composer (e.g. `--ignore-platform-reqs`).
required: false
working-directory:
description: >-
The directory where composer.json is located, if it is not in the repository root.
required: false
ignore-cache:
description: >-
Whether to ignore the cache. Values accepted: `'yes'`, `true`, `1`.
required: false
custom-cache-key:
description: >-
A custom cache key to use instead of an auto-generated cache key.
required: false
custom-cache-suffix:
description: >-
A custom suffix to add to the auto-generated cache key.
required: false
require-lock-file:
description: >-
Require lock file for install command.
required: false
default: "false"
runs:
using: "composite"
steps:
- name: "Determine PHP version"
id: "php"
shell: "bash"
run: "${GITHUB_ACTION_PATH}/bin/php_version.sh"
- name: "Determine whether we should ignore caching"
id: "should-cache"
shell: "bash"
run: "${GITHUB_ACTION_PATH}/bin/should_cache.sh \"${{ inputs.ignore-cache }}\""
- name: "Determine Composer paths"
id: "composer"
if: steps.should-cache.outputs.do-cache == 1
shell: "bash"
run: |
${GITHUB_ACTION_PATH}/bin/composer_paths.sh \
"" \
"${{ inputs.working-directory }}" \
"${{ steps.php.outputs.path }}"
- name: "Determine cache key"
id: "cache-key"
if: steps.should-cache.outputs.do-cache == 1
shell: "bash"
run: |
${GITHUB_ACTION_PATH}/bin/cache_key.sh \
"${{ runner.os }}" \
"${{ steps.php.outputs.version }}" \
"${{ inputs.dependency-versions }}" \
"${{ inputs.composer-options }}" \
"${{ hashFiles('**/composer.json', '**/composer.lock') }}" \
"${{ inputs.custom-cache-key }}" \
"${{ inputs.custom-cache-suffix }}" \
"${{ inputs.working-directory }}"
- name: "Cache Composer dependencies"
if: steps.should-cache.outputs.do-cache == 1
uses: "actions/cache@v4"
with:
path: "${{ steps.composer.outputs.cache-dir }}"
key: "${{ steps.cache-key.outputs.key }}"
restore-keys: |
${{ env.CACHE_RESTORE_KEY }}
- name: "Install Composer dependencies"
shell: "bash"
run: |
${GITHUB_ACTION_PATH}/bin/composer_install.sh \
"${{ inputs.dependency-versions }}" \
"${{ inputs.composer-options }}" \
"${{ inputs.working-directory }}" \
"${{ steps.php.outputs.path }}" \
"${{ steps.composer.outputs.composer_command }}" \
"${{ steps.composer.outputs.lock }}" \
"${{ inputs.require-lock-file }}"