Minor refactor in php.yml

This commit is contained in:
Shivam Mathur 2023-01-29 21:47:34 +05:30
parent a36edd3ca4
commit 755bbb1cc0
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -19,7 +19,8 @@ on:
- 'examples/**' - 'examples/**'
permissions: permissions:
contents: read contents: read
env:
default-php-version: '8.2'
jobs: jobs:
run: run:
name: Run name: Run
@ -44,7 +45,7 @@ jobs:
id: cache-env id: cache-env
uses: shivammathur/cache-extensions@develop uses: shivammathur/cache-extensions@develop
with: with:
php-version: ${{ matrix.php-versions || 8.2 }} php-version: ${{ matrix.php-versions || env.default-php-version }}
extensions: ${{ env.extensions }} extensions: ${{ env.extensions }}
key: ${{ env.key }} key: ${{ env.key }}
@ -58,7 +59,7 @@ jobs:
- name: Stage php-version-file - name: Stage php-version-file
if: ${{ matrix.php-version-file == 'php-version-file' }} if: ${{ matrix.php-version-file == 'php-version-file' }}
run: | run: |
echo 8.2 > php-version-file echo ${{ env.default-php-version }} > php-version-file
- name: Setup PHP with extensions and custom config - name: Setup PHP with extensions and custom config
run: node dist/index.js run: node dist/index.js
@ -71,7 +72,7 @@ jobs:
- name: Testing PHP version - name: Testing PHP version
run: | run: |
php -v php -v
php -r "if(strpos(phpversion(), '${{ matrix.php-versions || 8.2 }}') === false) {throw new Exception('Wrong PHP version Installed');}" php -r "if(strpos(phpversion(), '${{ matrix.php-versions || env.default-php-version }}') === false) {throw new Exception('Wrong PHP version Installed');}"
- name: Testing Composer version - name: Testing Composer version
run: | run: |