-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathaction.yml
100 lines (83 loc) · 2.99 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: "Setup Magento"
author: "Graycore"
description: "This action sets up a Magento instance for further actions like running tests, etc."
inputs:
php-version:
description: "Setup PHP version."
default: "8.1"
required: true
tools:
description: "Setup popular tools globally."
required: false
extensions:
description: "Setup PHP extensions."
required: false
coverage:
description: "Setup code coverage driver."
required: false
magento_repository:
required: false
default: "https://mirror.mage-os.org/"
description: "Where to install Magento from"
magento_version:
required: false
default: '~2.4.5'
description: "The version of Magento to use. This is only relevant if you are testing an extension."
apply_fixes:
required: false
default: 'false'
description: "Whether or not to apply fixes during setup."
mode:
required: true
default: 'extension'
description: "The mode for setup, one of: `extension` or `store`."
working-directory:
required: false
default: "."
description: "The working directory to run the action in."
outputs:
path:
description: "The absolute path to where Magento was set up."
value: ${{ steps.setup-magento-get-magento-path.outputs.path }}
runs:
using: "composite"
steps:
- name: Set PHP Version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
tools: ${{ inputs.tools }}
coverage: ${{ inputs.coverage }}
extensions: ${{ inputs.coverage }}
- run: |
MAGENTO_DIRECTORY=""
if [ "${{ inputs.mode }}" = 'extension' ]; then
MAGENTO_DIRECTORY="../magento2"
else
MAGENTO_DIRECTORY="${{ inputs.working-directory }}"
fi
echo "MAGENTO_DIRECTORY=$MAGENTO_DIRECTORY" >> $GITHUB_OUTPUT
id: setup-magento-compute-directory
shell: bash
- run: |
mkdir -p ${{ steps.setup-magento-compute-directory.outputs.MAGENTO_DIRECTORY }}
name: Make a directory that may not exist.
shell: bash
if: inputs.mode == 'extension'
- run: composer create-project --repository-url="${{ inputs.magento_repository }}" "${{ inputs.magento_version }}" ${{ steps.setup-magento-compute-directory.outputs.MAGENTO_DIRECTORY }} --no-install
working-directory: ${{ inputs.working-directory }}
shell: bash
name: Create Magento ${{ inputs.magento_version }} Project
if: inputs.mode == 'extension'
- uses: mage-os/github-actions/fix-magento-install@main
name: Fix Magento Out of Box Install Issues
with:
magento_directory: ${{ steps.setup-magento-compute-directory.outputs.MAGENTO_DIRECTORY }}
if: inputs.mode == 'extension' || inputs.apply_fixes == 'true'
- run: |
echo "path=$(realpath ${{ steps.setup-magento-compute-directory.outputs.MAGENTO_DIRECTORY }})" >> $GITHUB_OUTPUT
shell: bash
id: setup-magento-get-magento-path
branding:
icon: "code"
color: "green"