|
78 | 78 | fi |
79 | 79 | env: |
80 | 80 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + deploy-v3: |
| 82 | + needs: deploy-v2 |
| 83 | + name: Deploy scraper ^6.0 |
| 84 | + runs-on: ubuntu-24.04 |
| 85 | + |
| 86 | + steps: |
| 87 | + - name: Setup PHP |
| 88 | + uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f |
| 89 | + with: |
| 90 | + php-version: '8.4' |
| 91 | + |
| 92 | + - name: Checkout Code |
| 93 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 94 | + with: |
| 95 | + fetch-depth: 0 |
| 96 | + |
| 97 | + - name: Get Composer cache directory |
| 98 | + id: composer-cache |
| 99 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 100 | + |
| 101 | + - name: Cache Composer dependencies |
| 102 | + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 |
| 103 | + with: |
| 104 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 105 | + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} |
| 106 | + restore-keys: | |
| 107 | + ${{ runner.os }}-php- |
| 108 | +
|
| 109 | + - name: Install base dependencies (without scraper) |
| 110 | + run: | |
| 111 | + composer remove bvp/scraper --no-update || true |
| 112 | + composer install --no-interaction --no-progress |
| 113 | +
|
| 114 | + - name: Require scraper version ^6.0 |
| 115 | + run: composer require bvp/scraper:^6.0 --no-update |
| 116 | + |
| 117 | + - name: Update lock file for scraper |
| 118 | + run: composer update bvp/scraper --with-dependencies |
| 119 | + |
| 120 | + - name: Final install |
| 121 | + run: composer install --prefer-dist --no-interaction --no-progress |
| 122 | + |
| 123 | + - name: Scrape Data (v3) |
| 124 | + run: php scraper.php v3 |
| 125 | + |
| 126 | + - name: Deploy JSON for scraper v3 |
| 127 | + run: | |
| 128 | + git config --global user.name "github-actions[bot]" |
| 129 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 130 | + FILES=$( |
| 131 | + { |
| 132 | + git ls-files -m -- 'docs/v3' | grep '\.json$' |
| 133 | + git diff --cached --name-only --diff-filter=AM -- 'docs/v3' | grep '\.json$' |
| 134 | + git ls-files --others --exclude-standard -- 'docs/v3' | grep '\.json$' |
| 135 | + } | sort -u |
| 136 | + ) |
| 137 | + if [ -n "$FILES" ]; then |
| 138 | + git add $FILES |
| 139 | + git commit -m "chore: deploy JSON files to docs/v3 [skip ci]" || exit 0 |
| 140 | + git pull --rebase --autostash |
| 141 | + git push origin HEAD |
| 142 | + else |
| 143 | + echo "No JSON changes in docs/v3 to commit." |
| 144 | + fi |
| 145 | + env: |
| 146 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments