Skip to content

Commit 37a2645

Browse files
authored
Readme: Mention GitHub Actions usage (#77)
Added GitHub Actions section with PHP Matrix Action example.
1 parent 33495a3 commit 37a2645

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,50 @@
3535

3636
## Usage
3737

38+
### GitHub Actions
39+
40+
For generating PHP version matrix in GitHub Actions, use [PHP Matrix Action](https://github.com/marketplace/actions/php-matrix).
41+
42+
<details>
43+
44+
<summary>Example</summary>
45+
46+
```yml
47+
name: Test
48+
49+
on:
50+
push:
51+
52+
jobs:
53+
php-matrix:
54+
runs-on: ubuntu-latest
55+
outputs:
56+
versions: ${{ steps.php-matrix.outputs.versions }}
57+
steps:
58+
- uses: actions/checkout@v5
59+
with:
60+
sparse-checkout: composer.json
61+
sparse-checkout-cone-mode: false
62+
63+
- uses: typisttech/php-matrix-action@v2
64+
id: php-matrix
65+
66+
test:
67+
runs-on: ubuntu-latest
68+
needs: php-matrix
69+
strategy:
70+
matrix:
71+
php-version: ${{ fromJSON(needs.php-matrix.outputs.versions) }}
72+
steps:
73+
- uses: actions/checkout@v5
74+
- uses: shivammathur/setup-php@v2
75+
with:
76+
php-version: ${{ matrix.php-version }}
77+
- run: composer install
78+
- run: composer test
79+
```
80+
</details>
81+
3882
### List PHP versions that satisfy the required PHP constraint in `composer.json`
3983

4084
```console

0 commit comments

Comments
 (0)