Merge branch refs/heads/1.10.x into 1.11.x #1224
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
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions | |
name: "API Reference" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "1.11.x" | |
paths: | |
- 'src/**' | |
- 'composer.lock' | |
- 'apigen/**' | |
- '.github/workflows/apiref.yml' | |
concurrency: | |
group: apigen-${{ github.ref }} # will be canceled on subsequent pushes in branch | |
cancel-in-progress: true | |
jobs: | |
apigen: | |
name: "Run ApiGen" | |
runs-on: "ubuntu-latest" | |
timeout-minutes: 60 | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Install PHP" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "none" | |
php-version: "8.1" | |
- name: "Install dependencies" | |
run: "composer install --no-interaction --no-progress" | |
- name: "Install ApiGen dependencies" | |
working-directory: "apigen" | |
run: "composer install --no-interaction --no-progress" | |
- name: "Run ApiGen" | |
run: "apigen/vendor/bin/apigen -c apigen/apigen.neon --output docs -- src vendor/nikic/php-parser vendor/ondrejmirtes/better-reflection vendor/phpstan/phpdoc-parser" | |
- name: "Upload docs" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs | |
path: docs | |
deploy: | |
name: "Deploy" | |
needs: | |
- apigen | |
if: github.repository_owner == 'phpstan' | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "Install Node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "16" | |
- name: "Download docs" | |
uses: actions/download-artifact@v3 | |
with: | |
name: docs | |
path: docs | |
- name: "Sync with S3" | |
uses: jakejarvis/s3-sync-action@v0.5.1 | |
with: | |
args: --exclude '.git*/*' --follow-symlinks | |
env: | |
SOURCE_DIR: './docs' | |
DEST_DIR: ${{ github.ref_name }} | |
AWS_REGION: 'eu-west-1' | |
AWS_S3_BUCKET: "web-apiref.phpstan.org" | |
AWS_ACCESS_KEY_ID: ${{ secrets.APIREF_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.APIREF_AWS_SECRET_ACCESS_KEY }} | |
- name: "Invalidate CloudFront" | |
uses: chetan/invalidate-cloudfront-action@v2 | |
env: | |
DISTRIBUTION: "E37G1C2KWNAPBD" | |
PATHS: '/${{ github.ref_name }}/*' | |
AWS_REGION: 'eu-west-1' | |
AWS_ACCESS_KEY_ID: ${{ secrets.APIREF_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.APIREF_AWS_SECRET_ACCESS_KEY }} | |
- uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.PHPSTAN_BOT_TOKEN }} | |
repository: "phpstan/phpstan" | |
event-type: check_website_links | |
- name: "Check for broken links" | |
uses: ScholliYT/Broken-Links-Crawler-Action@v3 | |
with: | |
website_url: 'https://apiref.phpstan.org/${{ github.ref_name }}/index.html' | |
resolve_before_filtering: 'true' | |
verbose: 'warning' | |
max_retry_time: 30 | |
max_retries: 5 |