Attempting to fix markdown-interpolation-action's regex; adjusted ver… #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHP Build+Test | |
on: [push] | |
#push: | |
# branches: [ "main" ] | |
#pull_request: | |
# branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
supported-php-versions: | |
runs-on: ubuntu-latest | |
name: Get supported PHP versions | |
outputs: | |
php-versions: ${{ steps.versions.outputs.range }} | |
steps: | |
- uses: tighten/phpreleases-action@v1 | |
id: versions | |
test: | |
needs: supported-php-versions | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
matrix: | |
operating-system: [ubuntu-latest] | |
php-versions: ${{ fromJSON(needs.supported-php-versions.outputs.php-versions) }} | |
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install PHP ${{ matrix.php-versions }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Validate composer.json and composer.lock | |
run: composer validate --strict | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer packages | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress | |
- name: Run tests | |
run: composer run-script test | |
deploy: | |
#if: github.ref_type == 'tag' | |
needs: [supported-php-versions, test] | |
permissions: | |
id-token: write | |
pages: write | |
runs-on: ubuntu-latest | |
name: Deploy to GitHub Pages | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get phpDocumentor | |
run: wget https://phpdoc.org/phpDocumentor.phar | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress | |
- name: Generate phpDoc | |
run: composer run-script phpdoc | |
- name: Set replacement key/values | |
uses: actions/github-script@v6 | |
id: replacements | |
with: | |
script: | | |
const versions = ${{ needs.supported-php-versions.outputs.php-versions }}.map(x => x.toString()); | |
return { | |
CURRENT_VERSION: '${{ github.ref_name }}', | |
MIN_PHP_VERSION: versions.slice(0, 1), | |
TESTED_PHP_VERSIONS: `${versions.slice(0, versions.length - 1).join(', ')}, and ${versions.slice(-1)}`, | |
}; | |
- name: Interpolate markdown files | |
uses: austenstone/markdown-interpolation-action@v2 | |
with: | |
values: ${{ steps.replacements.outputs.result }} | |
files-regex: .*\.(md|htm|html) | |
- name: Upload GitHub Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/ | |
- name: Deploy GitHub Pages site | |
id: deployment | |
uses: actions/deploy-pages@v4 |