@@ -7,6 +7,10 @@ branding:
77 color : black
88
99inputs :
10+ composer-json :
11+ description : Path to composer.json
12+ default : composer.json
13+
1014 mode :
1115 description : Version format
1216 default : minor-only
@@ -15,10 +19,114 @@ inputs:
1519 description : Source of releases information
1620 default : auto
1721
22+ version :
23+ description : |
24+ The version of php-matrix to use. Leave blank for latest. For example: v1.0.2
25+ default : ' '
26+
27+ verify-attestation :
28+ description : Whether to verify PHP matrix tarball attestation
29+ default : true
30+
31+ github-token :
32+ description : GitHub token to use for authentication
33+ default : ${{ github.token }}
34+
1835outputs :
1936 matrix :
2037 description : The PHP version matrix
38+ value : ${{ steps.generate-matrix.outputs.matrix }}
2139
2240runs :
23- using : docker
24- image : Dockerfile
41+ using : " composite"
42+ steps :
43+ - name : Download PHP Matrix (Linux arm64)
44+ if : ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
45+ run : gh release download --repo typisttech/php-matrix --output php-matrix.tar.gz --pattern "${PATTERN}" "${TAG}"
46+ shell : bash
47+ working-directory : ${{ github.action_path }}
48+ env :
49+ PATTERN : php-matrix_linux_arm64.tar.gz
50+ TAG : ${{ inputs.version }}
51+ GH_TOKEN : ${{ inputs.github-token }}
52+
53+ - name : Download PHP Matrix (Linux amd64)
54+ if : ${{ runner.os == 'Linux' && runner.arch == 'x64' }}
55+ run : gh release download --repo typisttech/php-matrix --output php-matrix.tar.gz --pattern "${PATTERN}" "${TAG}"
56+ shell : bash
57+ working-directory : ${{ github.action_path }}
58+ env :
59+ PATTERN : php-matrix_linux_amd64.tar.gz
60+ TAG : ${{ inputs.version }}
61+ GH_TOKEN : ${{ github.token }}
62+
63+ - name : Download PHP Matrix (Darwin arm64)
64+ if : ${{ runner.os == 'macOS' && runner.arch == 'ARM64' }}
65+ run : gh release download --repo typisttech/php-matrix --output php-matrix.tar.gz --pattern "${PATTERN}" "${TAG}"
66+ shell : bash
67+ working-directory : ${{ github.action_path }}
68+ env :
69+ PATTERN : php-matrix_darwin_arm64.tar.gz
70+ TAG : ${{ inputs.version }}
71+ GH_TOKEN : ${{ inputs.github-token }}
72+
73+ - name : Download PHP Matrix (Darwin amd64)
74+ if : ${{ runner.os == 'macOS' && runner.arch == 'x64' }}
75+ run : gh release download --repo typisttech/php-matrix --output php-matrix.tar.gz --pattern "${PATTERN}" "${TAG}"
76+ shell : bash
77+ working-directory : ${{ github.action_path }}
78+ env :
79+ PATTERN : php-matrix_darwin_amd64.tar.gz
80+ TAG : ${{ inputs.version }}
81+ GH_TOKEN : ${{ inputs.github-token }}
82+
83+ - name : Verify Attestation
84+ if : ${{ inputs.verify-attestation == 'true' }}
85+ run : gh attestation verify --repo typisttech/php-matrix php-matrix.tar.gz
86+ shell : bash
87+ working-directory : ${{ github.action_path }}
88+ env :
89+ GH_TOKEN : ${{ inputs.github-token }}
90+
91+ - name : Unarchive the binary
92+ run : |
93+ mkdir bin
94+ tar -xvf php-matrix.tar.gz -C ./bin php-matrix
95+ shell : bash
96+ working-directory : ${{ github.action_path }}
97+
98+ - name : Add the binary into PATH
99+ run : echo "${ACTION_PATH}/bin" >> "$GITHUB_PATH"
100+ shell : bash
101+ env :
102+ ACTION_PATH : ${{ github.action_path }}
103+
104+ - name : Print PHP Matrix Version
105+ run : php-matrix --version
106+ shell : bash
107+
108+ - name : Generate Matrix
109+ id : generate-matrix
110+ run : |
111+ php-matrix composer --mode="${INPUT_MODE}" --source="${INPUT_SOURCE}" "${INPUT_COMPOSER_JSON}" > matrix 2>&1
112+ retVal=$?
113+
114+ echo "::group::===> Matrix Output"
115+ cat matrix
116+ echo "::endgroup::"
117+
118+ if [ $retVal -ne 0 ]; then
119+ echo "::error::Unable to generate matrix"
120+ exit 1
121+ fi
122+
123+ {
124+ echo 'matrix<<EOF'
125+ cat matrix
126+ echo EOF
127+ } >> "$GITHUB_OUTPUT"
128+ shell : sh
129+ env :
130+ INPUT_COMPOSER_JSON : ${{ inputs.composer-json }}
131+ INPUT_MODE : ${{ inputs.mode }}
132+ INPUT_SOURCE : ${{ inputs.source }}
0 commit comments