-
-
Notifications
You must be signed in to change notification settings - Fork 56
182 lines (174 loc) · 5.12 KB
/
acquire-transfermarkt-scraper.yml
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: acquire-transfermarkt-scraper
on:
schedule:
- cron: '0 4 * * TUE,FRI'
workflow_dispatch:
inputs:
season:
required: false
default: "2024"
description: Season to acquire data for
env:
SEASON: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.season || '2024' }}
DATA_DIR: data/raw/transfermarkt-scraper/${{ github.event_name == 'workflow_dispatch' && github.event.inputs.season || '2024' }}
jobs:
acquire-clubs:
runs-on: ubuntu-latest
container:
image: dcaribou/transfermarkt-datasets:linux-amd64-master
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: run acquire
run: |
make \
acquire_local \
ARGS="--asset clubs --seasons $SEASON"
- uses: actions/upload-artifact@v3
with:
name: clubs
path: ${{ env.DATA_DIR }}/clubs.json.gz
acquire-players:
runs-on: ubuntu-latest
container:
image: dcaribou/transfermarkt-datasets:linux-amd64-master
defaults:
run:
shell: bash -l {0}
needs: acquire-clubs
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: clubs
path: ${{ env.DATA_DIR }}
- name: run acquire
run: |
make \
acquire_local \
ARGS="--asset players --seasons $SEASON"
- uses: actions/upload-artifact@v3
with:
name: players
path: ${{ env.DATA_DIR }}/players.json.gz
acquire-games:
runs-on: ubuntu-latest
container:
image: dcaribou/transfermarkt-datasets:linux-amd64-master
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: run acquire
run: |
make \
acquire_local \
ARGS="--asset games --seasons $SEASON"
- uses: actions/upload-artifact@v3
with:
name: games
path: ${{ env.DATA_DIR }}/games.json.gz
acquire-game-lineups:
runs-on: ubuntu-latest
container:
image: dcaribou/transfermarkt-datasets:linux-amd64-master
defaults:
run:
shell: bash -l {0}
needs: acquire-games
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: games
path: ${{ env.DATA_DIR }}
- name: run acquire
run: |
make \
acquire_local \
ARGS="--asset game_lineups --seasons $SEASON"
- uses: actions/upload-artifact@v3
with:
name: game_lineups
path: ${{ env.DATA_DIR }}/game_lineups.json.gz
acquire-appearances:
runs-on: ubuntu-latest
container:
image: dcaribou/transfermarkt-datasets:linux-amd64-master
defaults:
run:
shell: bash -l {0}
needs: acquire-players
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: players
path: ${{ env.DATA_DIR }}
- name: run acquire
run: |
make \
acquire_local \
ARGS="--asset appearances --seasons $SEASON"
- uses: actions/upload-artifact@v3
with:
name: appearances
path: ${{ env.DATA_DIR }}/appearances.json.gz
dvc-push:
runs-on: ubuntu-latest
container:
image: dcaribou/transfermarkt-datasets:linux-amd64-master
defaults:
run:
shell: bash -l {0}
needs:
- acquire-clubs
- acquire-players
- acquire-games
- acquire-appearances
- acquire-game-lineups
steps:
- uses: actions/checkout@v4
with:
# a different (personal access) github token need to be setup here so that a 'add-and-commit' step below triggers the 'on-push' workflow
# checkout https://github.community/t/push-from-action-does-not-trigger-subsequent-action/16854
token: ${{ secrets.PA_GITHUB_TOKEN }}
- name: pull data
run: |
dvc pull
- uses: actions/download-artifact@v3
with:
name: clubs
path: ${{ env.DATA_DIR }}
- uses: actions/download-artifact@v3
with:
name: players
path: ${{ env.DATA_DIR }}
- uses: actions/download-artifact@v3
with:
name: games
path: ${{ env.DATA_DIR }}
- uses: actions/download-artifact@v3
with:
name: appearances
path: ${{ env.DATA_DIR }}
- uses: actions/download-artifact@v3
with:
name: game_lineups
path: ${{ env.DATA_DIR }}
- name: dvc commit and push
run: |
dvc commit -f && dvc push --remote s3
git config --global --add safe.directory '*'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- uses: EndBug/add-and-commit@v9
with:
add: 'data/raw/transfermarkt-scraper.dvc'
message: '🤖 updated `transfermarkt-scraper` raw data'
default_author: github_actions
pull: '--no-rebase'