Skip to content

Merge branch 2.1.x into 2.2.x #3949

Merge branch 2.1.x into 2.2.x

Merge branch 2.1.x into 2.2.x #3949

Workflow file for this run

# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "API Reference"
on:
workflow_dispatch:
push:
branches:
- "2.2.x"
paths:
- 'src/**'
- 'composer.lock'
- 'apigen/**'
- '!apigen/infra/**'
- '.github/workflows/apiref.yml'
env:
COMPOSER_ROOT_VERSION: "2.2.x-dev"
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: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: "Install PHP"
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
with:
coverage: "none"
php-version: "8.2"
- uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # v3
- name: "Install ApiGen dependencies"
uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # v3
with:
working-directory: "apigen"
- 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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: docs
path: docs
deploy:
name: "Deploy"
needs:
- apigen
if: github.repository_owner == 'phpstan'
runs-on: "ubuntu-latest"
permissions:
id-token: write
contents: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit
- name: "Download docs"
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: docs
path: docs
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@d979d5b3a71173a29b74b5b88418bfda9437d885 # v6.1.1
with:
role-to-assume: ${{ vars.APIREF_DEPLOY_ROLE_ARN }}
aws-region: us-east-1
- name: "Sync with S3"
run: |
aws s3 sync ./docs "s3://${{ vars.APIREF_BUCKET }}/${{ github.ref_name }}" \
--exclude '.git*/*' \
--follow-symlinks
- name: "Invalidate CloudFront"
run: |
aws cloudfront create-invalidation \
--distribution-id "${{ vars.APIREF_DISTRIBUTION_ID }}" \
--paths "/${{ github.ref_name }}/*"
- uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
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@21eab52f98097989d343116dbbd46dc4541b849b # v3.3.2
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