-
-
Notifications
You must be signed in to change notification settings - Fork 23
98 lines (95 loc) · 2.93 KB
/
fetch-data.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
name: Data Fetching
on:
push:
schedule:
- cron: "5 19 * * *"
workflow_dispatch:
jobs:
Fetch-Route-Data:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup Python environment
uses: actions/setup-python@v5
with:
python-version: '3.12'
architecture: 'x64'
cache: 'pip'
cache-dependency-path: crawling/requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./crawling/requirements.txt
- name: Crawling resources
env:
REQUEST_LIMIT: "6"
run: |
set -o xtrace
python ./crawling/parseHoliday.py
python ./crawling/ctb.py
python ./crawling/kmb.py
python ./crawling/nlb.py
python ./crawling/lrtfeeder.py
python ./crawling/lightRail.py
python ./crawling/mtr.py
python ./crawling/parseJourneyTime.py
python ./crawling/parseGtfs.py
python ./crawling/parseGtfsEn.py
python ./crawling/gmb.py
python ./crawling/sunferry.py
python ./crawling/fortuneferry.py
python ./crawling/hkkf.py
python ./crawling/matchGtfs.py
python ./crawling/cleansing.py
python ./crawling/mergeRoutes.py
python ./crawling/mergeStopList.py
python ./crawling/routeCompare.py
python ./crawling/mtrExits.py
- name: Archive crawling outputs
uses: actions/upload-artifact@v4
if: always()
with:
name: Crawled Files
retention-days: 14
path: |
holiday.json
routeFareList*
routeList*
stopList*
stopMap*
routeTime.json
gtfs
gtfs.json
routeGtfs*
gtfs.zip
ROUTE_BUS.xml
route-ts/
exits.mtr.json
- name: Update MD5
run: |
md5sum routeFareList.min.json | cut -f1 -d ' ' | tr -d $'\n' > routeFareList.md5
md5sum routeFareList.alpha.min.json | cut -f1 -d ' ' | tr -d $'\n' > routeFareList.alpha.md5
- name: create deployment folder
run: mkdir -p build
- name: cp files into deployment folder
run: |
cp \
routeFareList.json \
routeFareList.min.json \
routeFareList.alpha.json \
routeFareList.alpha.min.json \
routeFareList.md5 \
routeFareList.alpha.md5 \
CNAME \
exits.mtr.json \
build/
- name: cp route-ts into deployment folder
run: cp -r route-ts build
- name: Update resources
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build
commit-message: Update resources
branch: gh-pages
clean: false