2020-11-02 04:34:21 +07:00
name : Docs workflow
on :
2020-12-01 10:18:41 +07:00
workflow_dispatch :
2020-11-02 04:34:21 +07:00
schedule :
2021-03-03 10:46:13 +07:00
- cron : '0 15 * * 6'
2022-05-26 07:50:23 +07:00
permissions :
contents : read
2020-11-02 04:34:21 +07:00
jobs :
create :
2022-05-26 07:50:23 +07:00
permissions :
contents : none
2020-11-02 04:34:21 +07:00
name : Create
runs-on : ${{ matrix.operating-system }}
strategy :
fail-fast : false
matrix :
2023-11-23 13:27:50 +07:00
operating-system : [ ubuntu-22.04, ubuntu-20.04, windows-2022, macos-12]
2023-11-23 13:42:26 +07:00
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' ]
2020-11-02 04:34:21 +07:00
steps :
- name : Setup PHP
uses : shivammathur/setup-php@v2
with :
php-version : ${{ matrix.php-versions }}
2022-01-29 08:59:03 +07:00
- name : Create for Linux and macOS
2020-11-02 04:34:21 +07:00
env :
file : php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version : ${{ matrix.php-versions }}
2022-01-20 23:33:33 +07:00
if : matrix.operating-system != 'windows-2022'
2020-11-02 04:34:21 +07:00
run : |
echo "## PHP $version" >> "$file"
printf "\n" >> "$file"
echo "\`\`\`" >> "$file"
php -m >> "$file"
echo "\`\`\`" >> "$file"
printf "\n" >> "$file"
2022-01-29 08:59:03 +07:00
- name : Create for Windows
2020-11-02 04:34:21 +07:00
env :
file : php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
version : ${{ matrix.php-versions }}
2022-01-20 23:33:33 +07:00
if : matrix.operating-system == 'windows-2022'
2020-11-02 04:34:21 +07:00
run : |
2020-12-01 10:18:41 +07:00
Write-Output "## PHP ${{ matrix.php-versions }}`n" | Out-File -FilePath "$env:file"
2020-11-02 04:34:21 +07:00
Write-Output "``````" | Out-File -FilePath "$env:file" -Append
php -m | Out-File -FilePath "$env:file" -Append
Write-Output "```````n" | Out-File -FilePath "$env:file" -Append
2022-01-29 08:59:03 +07:00
- name : Upload artifacts
2023-12-18 17:33:19 +07:00
uses : actions/upload-artifact@v4
2020-11-02 04:34:21 +07:00
with :
2023-12-24 03:42:22 +07:00
name : lists-php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
2020-11-02 04:34:21 +07:00
path : php${{ matrix.php-versions }}-${{ matrix.operating-system }}.md
update :
2022-05-26 07:50:23 +07:00
permissions :
contents : write # for Git to git push
2020-11-02 04:34:21 +07:00
name : Update
needs : create
runs-on : ubuntu-latest
steps :
- name : Checkout
2023-09-09 17:53:40 +07:00
uses : actions/checkout@v4
2020-11-02 04:34:21 +07:00
with :
repository : ${{ github.repository }}.wiki
2022-01-29 08:59:03 +07:00
- name : Download artifacts
2023-12-18 17:33:16 +07:00
uses : actions/download-artifact@v4
2020-11-02 04:34:21 +07:00
with :
2023-12-24 03:42:22 +07:00
path : ${{ github.workspace }}/lists
pattern : lists-*
merge-multiple : true
2022-01-29 08:59:03 +07:00
- name : Configure Git
run : |
2020-11-02 04:34:21 +07:00
git config --local user.email "${{ secrets.email }}"
git config --local user.name "${{ github.repository_owner }}"
2022-01-29 08:59:03 +07:00
- name : Combine
run : |
2023-11-23 13:27:50 +07:00
for os in ubuntu-22.04 ubuntu-20.04 windows-2022 windows-2019 macos-11 macos-12 macos-13; do
2020-12-01 10:18:41 +07:00
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
2023-11-23 13:42:26 +07:00
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; do
2023-11-23 13:27:50 +07:00
if [[ "$os" = "macos-11" || "$os" = "macos-13" ]]; then
cat lists/php"$version"-macos-12.md >> Php-extensions-loaded-on-"$os".md
2022-01-20 23:33:33 +07:00
elif [ "$os" = "windows-2019" ]; then
cat lists/php"$version"-windows-2022.md >> Php-extensions-loaded-on-"$os".md
2021-03-03 10:46:13 +07:00
else
cat lists/php"$version"-"$os".md >> Php-extensions-loaded-on-"$os".md
fi
2020-11-02 04:34:21 +07:00
done
done
rm -rf ./lists
2022-01-29 08:59:03 +07:00
- name : Update
run : |
2020-11-02 04:34:21 +07:00
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