Merge pull request #3 from php-fast-forward/dependabot/github_actions… #77
This file contains hidden or 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: Generate Reports and Deploy to GitHub Pages | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| reports: | |
| name: Generate Reports | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: | | |
| echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| uses: php-actions/composer@v6 | |
| env: | |
| COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }' | |
| with: | |
| php_version: '8.3' | |
| - name: Generate reports | |
| uses: php-actions/composer@v6 | |
| with: | |
| php_version: '8.3' | |
| php_extensions: pcov | |
| command: 'dev-tools' | |
| args: 'reports' | |
| - name: Fix permissions | |
| run: | | |
| chmod -c -R +rX "public/" | while read line; do | |
| echo "::warning title=Invalid file permissions automatically fixed::$line" | |
| done | |
| - name: Upload artifact | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: public/ | |
| deploy: | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| name: Deploy to GitHub Pages | |
| needs: reports | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |