2020-11-02 03:04:21 +05:30
name : Docs workflow
on :
2020-12-01 08:48:41 +05:30
workflow_dispatch :
2020-11-02 03:04:21 +05:30
schedule :
2021-03-03 09:16:13 +05:30
- cron : '0 15 * * 6'
2022-05-26 00:50:23 +00:00
permissions :
contents : read
2020-11-02 03:04:21 +05:30
jobs :
create :
2022-05-26 00:50:23 +00:00
permissions :
contents : none
2020-11-02 03:04:21 +05:30
name : Create
runs-on : ${{ matrix.operating-system }}
strategy :
fail-fast : false
matrix :
2024-10-21 06:20:59 +05:30
operating-system : [ ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, windows-2022, macos-13]
2024-11-04 09:55:55 +05:30
php-versions : [ '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' , '8.4' , '8.5' ]
2020-11-02 03:04:21 +05:30
steps :
- name : Setup PHP
uses : shivammathur/setup-php@v2
with :
2024-12-02 11:04:50 +02:00
php-version : ${{ matrix.php-versions }}
2024-12-01 07:14:07 +05:30
tools : none
2024-12-01 06:00:17 +05:30
- name : Create file with all extensions for Linux and macOS
env :
file : php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version : ${{ matrix.php-versions }}
if : matrix.operating-system != 'windows-2022'
run : |
php -m >> "$file.all"
- name : Create file with all extensions for Windows
env :
file : php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version : ${{ matrix.php-versions }}
if : matrix.operating-system == 'windows-2022'
run : |
php -m | Out-File -FilePath "$env:file.all" -Append
- name : Setup PHP
uses : shivammathur/setup-php@v2
with :
php-version : ${{ matrix.php-versions }}
extensions : none
2024-12-01 07:14:07 +05:30
tools : none
2024-12-01 06:00:17 +05:30
- name : Create final file for Linux and macOS
2020-11-02 03:04:21 +05:30
env :
file : php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version : ${{ matrix.php-versions }}
2022-01-20 22:03:33 +05:30
if : matrix.operating-system != 'windows-2022'
2020-11-02 03:04:21 +05:30
run : |
echo "## PHP $version" >> "$file"
printf "\n" >> "$file"
echo "\`\`\`" >> "$file"
2024-12-01 06:00:17 +05:30
php -m >> "$file.builtin"
while IFS= read -r line; do
if [[ $line == [* || -z "${line// }" ]]; then
echo "$line" >> "$file"
elif grep -q "^$line" "$file.builtin"; then
echo "$line (builtin)" >> "$file"
else
echo "$line (shared)" >> "$file"
fi
done < "$file.all"
2020-11-02 03:04:21 +05:30
echo "\`\`\`" >> "$file"
printf "\n" >> "$file"
2024-12-01 06:00:17 +05:30
rm "$file.all" "$file.builtin"
- name : Create final file for Windows
2020-11-02 03:04:21 +05:30
env :
file : php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version : ${{ matrix.php-versions }}
2022-01-20 22:03:33 +05:30
if : matrix.operating-system == 'windows-2022'
2020-11-02 03:04:21 +05:30
run : |
2020-12-01 08:48:41 +05:30
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
2020-11-02 03:04:21 +05:30
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
2024-12-01 06:00:17 +05:30
php -m | Out-File -FilePath "$env:file.builtin" -Append
Get-Content "$env:file.all" | ForEach-Object {
if ($_.startsWith('[') -or -not $_.trim()) {
Write-Output "$_" | Out-File -FilePath "$env:file" -Append
} elseif ($_ -in (Get-Content "$env:file.builtin")) {
Write-Output "$_ (builtin)" | Out-File -FilePath "$env:file" -Append
} else {
Write-Output "$_ (shared)" | Out-File -FilePath "$env:file" -Append
}
}
2020-11-02 03:04:21 +05:30
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
2024-12-01 06:00:17 +05:30
Remove-Item "$env:file.all" -Force
Remove-Item "$env:file.builtin" -Force
2022-01-29 07:29:03 +05:30
- name : Upload artifacts
2023-12-18 10:33:19 +00:00
uses : actions/upload-artifact@v4
2020-11-02 03:04:21 +05:30
with :
2023-12-24 02:12:22 +05:30
name : lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
2020-11-02 03:04:21 +05:30
path : php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
update :
2022-05-26 00:50:23 +00:00
permissions :
contents : write # for Git to git push
2020-11-02 03:04:21 +05:30
name : Update
needs : create
runs-on : ubuntu-latest
steps :
- name : Checkout
2023-09-09 16:23:40 +05:30
uses : actions/checkout@v4
2020-11-02 03:04:21 +05:30
with :
repository : ${{ github.repository }}.wiki
2022-01-29 07:29:03 +05:30
- name : Download artifacts
2023-12-18 10:33:16 +00:00
uses : actions/download-artifact@v4
2020-11-02 03:04:21 +05:30
with :
2023-12-24 02:12:22 +05:30
path : ${{ github.workspace }}/lists
pattern : lists-*
merge-multiple : true
2022-01-29 07:29:03 +05:30
- name : Configure Git
run : |
2020-11-02 03:04:21 +05:30
git config --local user.email "${{ secrets.email }}"
git config --local user.name "${{ github.repository_owner }}"
2022-01-29 07:29:03 +05:30
- name : Combine
run : |
2024-11-04 09:55:00 +05:30
for os in ubuntu-24.04 ubuntu-22.04 ubuntu-20.04 windows-2022 windows-2019 macos-13 macos-14 macos-15; do
2020-12-01 08:48:41 +05:30
echo "These are extensions which are loaded by default on the following PHP versions. More extensions which are available as packages and available on pecl are supported by setup-php. Refer to [php extension support](https://github.com/shivammathur/setup-php#heavy_plus_sign-php-extension-support) for more details." > Php-extensions-loaded-on-"$os".md
2024-11-04 09:55:55 +05:30
for version in 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 8.4 8.5; do
2024-11-04 09:55:00 +05:30
if [[ "${os%-*}" = "macos" ]]; then
2024-10-21 06:20:59 +05:30
cat lists/php"$version"-macos-13.md >> Php-extensions-loaded-on-"$os".md
2024-11-04 09:55:00 +05:30
elif [ "${os%-*}" = "windows" ]; then
2022-01-20 22:03:33 +05:30
cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
2021-03-03 09:16:13 +05:30
else
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md
fi
2020-11-02 03:04:21 +05:30
done
done
rm -rf ./lists
2022-01-29 07:29:03 +05:30
- name : Update
run : |
2020-11-02 03:04:21 +05:30
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
git add .
git commit -m "Update PHP extensions on wiki - $(date +'%d-%m-%y')"
git push -f https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git master || true
fi