Skip to content

Merge branch refs/heads/2.1.x into 2.2.x #3706

Merge branch refs/heads/2.1.x into 2.2.x

Merge branch refs/heads/2.1.x into 2.2.x #3706

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/**'
- '.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"
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
with:
egress-policy: audit
- name: "Install Node"
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "16"
- name: "Download docs"
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: docs
path: docs
- name: "Sync with S3"
uses: jakejarvis/s3-sync-action@be0c4ab89158cac4278689ebedd8407dd5f35a83 # 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@12d242edc7752fca9140c2034be28792ad22c5a8 # v2.4.1
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@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