Skip to content

Commit ae6c357

Browse files
committed
fix(ci): matrix as output
1 parent 2be2b4d commit ae6c357

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

.github/workflows/build-latest.yml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,31 @@ on: # yamllint disable-line rule:truthy
1212
name: 🚀 Build docker images with latest tag
1313

1414
jobs:
15+
# https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/expressions#example-returning-a-json-object
16+
prepare:
17+
runs-on: "ubuntu-latest"
18+
outputs:
19+
matrix: ${{ steps.set-matrix.outputs.matrix }}
20+
steps:
21+
- id: set-matrix
22+
run: |
23+
echo "::set-output name=matrix::{\"os_name\": [\"alpine\"], \"php_version\": [\"8.1\", \"8.2\"], \"php_type\": [\"fpm\", \"cli\", \"supervisord\"]}"
24+
1525
build:
26+
needs: prepare
1627
runs-on: "ubuntu-latest"
1728
strategy:
1829
fail-fast: true
19-
matrix:
20-
os_name: ["alpine"]
21-
php_version: ["8.1", "8.2"]
22-
php_type: ["fpm", "cli", "supervisord"]
23-
24-
steps:
25-
- name: 🚀 Build
26-
uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master
27-
with:
28-
os: "ubuntu-latest"
29-
push-to-hub: ${{ github.event_name != 'pull_request' }}
30-
image-namespace: "wayofdev/php-base"
31-
image-template: ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
32-
image-version: latest
33-
secrets:
34-
docker-username: ${{ secrets.DOCKER_USERNAME }}
35-
docker-password: ${{ secrets.DOCKER_TOKEN }}
30+
matrix: ${{ fromJson(needs.prepare.outputs.matrix )}}
31+
uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master
32+
with:
33+
os: "ubuntu-latest"
34+
push-to-hub: ${{ github.event_name != 'pull_request' }}
35+
image-namespace: "wayofdev/php-base"
36+
image-template: ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
37+
image-version: latest
38+
secrets:
39+
docker-username: ${{ secrets.DOCKER_USERNAME }}
40+
docker-password: ${{ secrets.DOCKER_TOKEN }}
3641

3742
...

0 commit comments

Comments
 (0)