Skip to content

Commit edf0223

Browse files
committed
Add extension type in docs workflow
1 parent 516490f commit edf0223

1 file changed

Lines changed: 44 additions & 4 deletions

File tree

‎.github/workflows/docs.yml‎

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,26 @@ jobs:
2222
uses: shivammathur/setup-php@v2
2323
with:
2424
php-version: ${{ matrix.php-versions }}
25-
- name: Create for Linux and macOS
25+
- name: Create file with all extensions for Linux and macOS
26+
env:
27+
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
28+
version: ${{ matrix.php-versions }}
29+
if: matrix.operating-system != 'windows-2022'
30+
run: |
31+
php -m >> "$file.all"
32+
- name: Create file with all extensions for Windows
33+
env:
34+
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
35+
version: ${{ matrix.php-versions }}
36+
if: matrix.operating-system == 'windows-2022'
37+
run: |
38+
php -m | Out-File -FilePath "$env:file.all" -Append
39+
- name: Setup PHP
40+
uses: shivammathur/setup-php@v2
41+
with:
42+
php-version: ${{ matrix.php-versions }}
43+
extensions: none
44+
- name: Create final file for Linux and macOS
2645
env:
2746
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
2847
version: ${{ matrix.php-versions }}
@@ -31,19 +50,40 @@ jobs:
3150
echo "## PHP $version" >> "$file"
3251
printf "\n" >> "$file"
3352
echo "\`\`\`" >> "$file"
34-
php -m >> "$file"
53+
php -m >> "$file.builtin"
54+
while IFS= read -r line; do
55+
if [[ $line == [* || -z "${line// }" ]]; then
56+
echo "$line" >> "$file"
57+
elif grep -q "^$line" "$file.builtin"; then
58+
echo "$line (builtin)" >> "$file"
59+
else
60+
echo "$line (shared)" >> "$file"
61+
fi
62+
done < "$file.all"
3563
echo "\`\`\`" >> "$file"
3664
printf "\n" >> "$file"
37-
- name: Create for Windows
65+
rm "$file.all" "$file.builtin"
66+
- name: Create final file for Windows
3867
env:
3968
file: php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
4069
version: ${{ matrix.php-versions }}
4170
if: matrix.operating-system == 'windows-2022'
4271
run: |
4372
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
4473
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
45-
php -m | Out-File -FilePath "$env:file" -Append
74+
php -m | Out-File -FilePath "$env:file.builtin" -Append
75+
Get-Content "$env:file.all" | ForEach-Object {
76+
if ($_.startsWith('[') -or -not $_.trim()) {
77+
Write-Output "$_" | Out-File -FilePath "$env:file" -Append
78+
} elseif ($_ -in (Get-Content "$env:file.builtin")) {
79+
Write-Output "$_ (builtin)" | Out-File -FilePath "$env:file" -Append
80+
} else {
81+
Write-Output "$_ (shared)" | Out-File -FilePath "$env:file" -Append
82+
}
83+
}
4684
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
85+
Remove-Item "$env:file.all" -Force
86+
Remove-Item "$env:file.builtin" -Force
4787
- name: Upload artifacts
4888
uses: actions/upload-artifact@v4
4989
with:

0 commit comments

Comments
 (0)