-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (122 loc) · 4.65 KB
/
cron.yml
File metadata and controls
146 lines (122 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: cron
on:
schedule:
- cron: '0,30 * * * *'
workflow_dispatch:
concurrency:
group: cron-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
deploy-v2:
name: Deploy scraper ^5.0
runs-on: ubuntu-24.04
steps:
- name: Setup PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f
with:
php-version: '8.4'
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- 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@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install base dependencies (without scraper)
run: |
composer remove bvp/scraper --no-update || true
composer install --no-interaction --no-progress
- name: Require scraper version ^5.0
run: composer require bvp/scraper:^5.0 --no-update
- name: Update lock file for scraper
run: composer update bvp/scraper --with-dependencies
- name: Final install
run: composer install --prefer-dist --no-interaction --no-progress
- name: Scrape Data (v2)
run: php scraper.php v2
- name: Deploy JSON for scraper v2
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
FILES=$(
{
git ls-files -m -- 'docs/v2' | grep '\.json$'
git diff --cached --name-only --diff-filter=AM -- 'docs/v2' | grep '\.json$'
git ls-files --others --exclude-standard -- 'docs/v2' | grep '\.json$'
} | sort -u
)
if [ -n "$FILES" ]; then
git add $FILES
git commit -m "chore: deploy JSON files to docs/v2 [skip ci]" || exit 0
git pull --rebase --autostash
git push origin HEAD
else
echo "No JSON changes in docs/v2 to commit."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy-v3:
needs: deploy-v2
name: Deploy scraper ^6.0
runs-on: ubuntu-24.04
steps:
- name: Setup PHP
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f
with:
php-version: '8.4'
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
- 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@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install base dependencies (without scraper)
run: |
composer remove bvp/scraper --no-update || true
composer install --no-interaction --no-progress
- name: Require scraper version ^6.0
run: composer require bvp/scraper:^6.0 --no-update
- name: Update lock file for scraper
run: composer update bvp/scraper --with-dependencies
- name: Final install
run: composer install --prefer-dist --no-interaction --no-progress
- name: Scrape Data (v3)
run: php scraper.php v3
- name: Deploy JSON for scraper v3
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
FILES=$(
{
git ls-files -m -- 'docs/v3' | grep '\.json$'
git diff --cached --name-only --diff-filter=AM -- 'docs/v3' | grep '\.json$'
git ls-files --others --exclude-standard -- 'docs/v3' | grep '\.json$'
} | sort -u
)
if [ -n "$FILES" ]; then
git add $FILES
git commit -m "chore: deploy JSON files to docs/v3 [skip ci]" || exit 0
git pull --rebase --autostash
git push origin HEAD
else
echo "No JSON changes in docs/v3 to commit."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}