Cache PHP #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Cache PHP' | |
on: | |
workflow_dispatch: | |
inputs: | |
php-versions: | |
description: 'PHP version to cache' | |
default: '5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3' | |
required: false | |
jobs: | |
get-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
php_matrix: ${{ steps.set-matrix.outputs.php_matrix }} | |
steps: | |
- name: Get matrix | |
id: set-matrix | |
run: | | |
IFS=' ' read -r -a PHP_VERSIONS <<<"${{ github.event.inputs.php-versions }}" | |
php_array=() | |
for php in "${PHP_VERSIONS[@]}"; do | |
php_array+=("{\"php\": \"$php\"}") | |
done | |
echo "php_matrix={\"include\":[$(echo "${php_array[@]}" | sed -e 's|} {|}, {|g')]}" | |
echo "php_matrix={\"include\":[$(echo "${php_array[@]}" | sed -e 's|} {|}, {|g')]}" >> "$GITHUB_OUTPUT" | |
cache: | |
needs: get-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: ${{fromJson(needs.get-matrix.outputs.php_matrix)}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create builds directory | |
run: mkdir builds | |
- name: Fetch files | |
run: bash scripts/fetch.sh ${{ matrix.php }} builds | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Install cloudsmith-cli | |
run: pip install --upgrade cloudsmith-cli | |
- name: Release | |
run: bash scripts/release.sh | |
env: | |
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} | |
GITHUB_MESSAGE: ${{ github.event.head_commit.message }} | |
GITHUB_RELEASES: php${{ matrix.php }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |