|
| 1 | +name: Publish Pages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [dist] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
| 10 | +env: |
| 11 | + GITHUB_ACTIONS: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + index: |
| 15 | + name: Index |
| 16 | + runs-on: ubuntu-latest |
| 17 | + timeout-minutes: 5 |
| 18 | + |
| 19 | + strategy: |
| 20 | + fail-fast: true |
| 21 | + |
| 22 | + environment: |
| 23 | + name: pages-build |
| 24 | + url: ${{ steps.config.outputs.base_url }} |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + ref: staging |
| 30 | + sparse-checkout: | |
| 31 | + .github/pages/_config.yml |
| 32 | + README.md |
| 33 | + sparse-checkout-cone-mode: false |
| 34 | + |
| 35 | + - name: Move pages config |
| 36 | + run: | |
| 37 | + mv .github/pages/_config.yml ./_config.yml |
| 38 | + rm -rf ./.github |
| 39 | +
|
| 40 | + - name: Setup Pages |
| 41 | + id: config |
| 42 | + uses: actions/configure-pages@v3 |
| 43 | + with: |
| 44 | + generator_config_file: ./_config.yml |
| 45 | + |
| 46 | + - name: Build Pages |
| 47 | + uses: actions/jekyll-build-pages@v1 |
| 48 | + |
| 49 | + - uses: actions/upload-artifact@v3 |
| 50 | + with: |
| 51 | + name: pages-index-html |
| 52 | + path: | |
| 53 | + ./_site |
| 54 | + !./_site/**/*.md |
| 55 | +
|
| 56 | + coverage: |
| 57 | + name: Coverage |
| 58 | + runs-on: ubuntu-latest |
| 59 | + timeout-minutes: 5 |
| 60 | + |
| 61 | + strategy: |
| 62 | + fail-fast: true |
| 63 | + |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v3 |
| 66 | + |
| 67 | + - name: Setup PHP 8.2.9 with Xdebug |
| 68 | + uses: shivammathur/setup-php@v2 |
| 69 | + with: |
| 70 | + php-version: 8.2 |
| 71 | + coverage: xdebug |
| 72 | + tools: composer |
| 73 | + |
| 74 | + - name: Restore Composer package cache |
| 75 | + uses: actions/cache@v3 |
| 76 | + with: |
| 77 | + path: | |
| 78 | + ~/.cache/composer/files |
| 79 | + ~/.cache/composer/vcs |
| 80 | + key: "composer-v2-cache-8.2.9-${{ hashFiles('./composer.json') }}" |
| 81 | + restore-keys: | |
| 82 | + composer-v2-cache- |
| 83 | +
|
| 84 | + - name: Install Composer dependencies |
| 85 | + run: composer install --prefer-dist --no-interaction |
| 86 | + |
| 87 | + - name: Generate coverage html |
| 88 | + run: composer coverage-ci |
| 89 | + |
| 90 | + - name: Generate coverage badge |
| 91 | + uses: timkrase/phpunit-coverage-badge@v1.2.1 |
| 92 | + with: |
| 93 | + report_type: html |
| 94 | + report: .phpunit/coverage/index.html |
| 95 | + coverage_badge_path: .phpunit/coverage/badge.svg |
| 96 | + |
| 97 | + - uses: actions/upload-artifact@v3 |
| 98 | + with: |
| 99 | + name: pages-coverage-html |
| 100 | + path: .phpunit/coverage |
| 101 | + |
| 102 | + docs: |
| 103 | + name: Docs |
| 104 | + runs-on: ubuntu-latest |
| 105 | + timeout-minutes: 5 |
| 106 | + |
| 107 | + strategy: |
| 108 | + fail-fast: true |
| 109 | + |
| 110 | + steps: |
| 111 | + - uses: actions/checkout@v3 |
| 112 | + |
| 113 | + - name: Setup PHP 8.2.9 with Xdebug |
| 114 | + uses: shivammathur/setup-php@v2 |
| 115 | + with: |
| 116 | + php-version: 8.2 |
| 117 | + tools: composer, phive |
| 118 | + |
| 119 | + - name: Restore Composer package cache |
| 120 | + uses: actions/cache@v3 |
| 121 | + with: |
| 122 | + path: | |
| 123 | + ~/.cache/composer/files |
| 124 | + ~/.cache/composer/vcs |
| 125 | + key: "composer-v2-cache-8.2.9-${{ hashFiles('./composer.json') }}" |
| 126 | + restore-keys: | |
| 127 | + composer-v2-cache- |
| 128 | +
|
| 129 | + - name: Install Composer dependencies |
| 130 | + run: composer install --prefer-dist --no-interaction |
| 131 | + |
| 132 | + - name: Install phpDocumentor |
| 133 | + run: composer install-php-documentor |
| 134 | + |
| 135 | + - name: Generate phpDocumentor html |
| 136 | + run: composer docs-ci |
| 137 | + |
| 138 | + - uses: actions/upload-artifact@v3 |
| 139 | + with: |
| 140 | + name: pages-docs-html |
| 141 | + path: ./docs-build |
| 142 | + |
| 143 | + package: |
| 144 | + name: Package |
| 145 | + needs: [index, coverage, docs] |
| 146 | + runs-on: ubuntu-latest |
| 147 | + timeout-minutes: 5 |
| 148 | + |
| 149 | + strategy: |
| 150 | + fail-fast: true |
| 151 | + |
| 152 | + steps: |
| 153 | + - uses: actions/download-artifact@v3 |
| 154 | + with: |
| 155 | + name: pages-index-html |
| 156 | + path: ./ |
| 157 | + |
| 158 | + - uses: actions/download-artifact@v3 |
| 159 | + with: |
| 160 | + name: pages-coverage-html |
| 161 | + path: ./coverage |
| 162 | + |
| 163 | + - uses: actions/download-artifact@v3 |
| 164 | + with: |
| 165 | + name: pages-docs-html |
| 166 | + path: ./docs |
| 167 | + |
| 168 | + - name: Fix permissions |
| 169 | + run: | |
| 170 | + chmod -c -R +rX "./" | while read line; do |
| 171 | + echo "::warning title=Invalid file permissions automatically fixed::$line" |
| 172 | + done |
| 173 | +
|
| 174 | + - uses: actions/upload-pages-artifact@v2 |
| 175 | + with: |
| 176 | + name: github-pages |
| 177 | + path: ./ |
| 178 | + |
| 179 | + publish: |
| 180 | + name: Publish |
| 181 | + needs: [package] |
| 182 | + runs-on: ubuntu-latest |
| 183 | + timeout-minutes: 5 |
| 184 | + |
| 185 | + strategy: |
| 186 | + fail-fast: true |
| 187 | + |
| 188 | + permissions: |
| 189 | + pages: write |
| 190 | + id-token: write |
| 191 | + |
| 192 | + environment: |
| 193 | + name: github-pages |
| 194 | + url: ${{ steps.deployment.outputs.page_url }} |
| 195 | + |
| 196 | + steps: |
| 197 | + - name: Deploy to GitHub Pages |
| 198 | + id: deployment |
| 199 | + uses: actions/deploy-pages@v2 |
0 commit comments