-
-
Notifications
You must be signed in to change notification settings - Fork 5
55 lines (50 loc) · 1.71 KB
/
cache.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
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'
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 }}