mirror of
https://github.com/ivuorinen/actions.git
synced 2026-01-26 11:34:00 +00:00
feat: add few first actions and workflows
This commit is contained in:
59
php-composer/action.yml
Normal file
59
php-composer/action.yml
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
|
||||
name: Run Composer Install on defined PHP version
|
||||
description: "Runs Composer install on the repository"
|
||||
author: "Ismo Vuorinen"
|
||||
branding:
|
||||
icon: package
|
||||
color: gray-dark
|
||||
|
||||
inputs:
|
||||
php:
|
||||
description: 'PHP Version to use'
|
||||
required: true
|
||||
default: "8.3"
|
||||
args:
|
||||
description: 'Arguments to pass to Composer'
|
||||
required: false
|
||||
default: '--no-progress --prefer-dist --optimize-autoloader'
|
||||
|
||||
outputs:
|
||||
lock:
|
||||
description: "composer.lock or composer.json file hash"
|
||||
value: ${{ steps.hash.outputs.lock }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- name: Get composer.lock or composer.json hash for caching
|
||||
id: hash
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -f composer.lock ]; then
|
||||
echo "lock=${{ hashFiles('**/composer.lock') }}" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "lock=${{ hashFiles('**/composer.json') }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Cache Composer packages
|
||||
id: composer-cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ inputs.php }}-${{ runs.hash.outputs.lock }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-${{ inputs.php }}-${{ runs.hash.outputs.lock }}
|
||||
${{ runner.os }}-php-${{ inputs.php }}-
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: PHP ${{ inputs.php }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ inputs.php }}
|
||||
tools: composer
|
||||
extensions: ${{ inputs.extensions }}
|
||||
|
||||
- name: Composer Install
|
||||
shell: bash
|
||||
run: composer install ${{ inputs.args }}
|
||||
Reference in New Issue
Block a user