generated from litingyes/nextjs-app-template
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (134 loc) · 4.29 KB
/
crawler.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
name: Pull and commit data
on:
workflow_dispatch:
schedule:
- cron: 0 8 * * *
- cron: 0 0 * * 0
- cron: 0 0 1 * *
jobs:
images:
if: github.event.schedule == '0 8 * * *'
needs: []
name: update-images
runs-on: ubuntu-latest
env:
AZURE_SUBSCRIPTION_KEY: ${{secrets.AZURE_SUBSCRIPTION_KEY}}
ALGOLIA_APPLICATION_ID: ${{secrets.ALGOLIA_APPLICATION_ID}}
ALGOLIA_WRITE_API_KEY: ${{secrets.ALGOLIA_WRITE_API_KEY}}
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: poetry
- run: poetry install
- name: pull bing images
run: |
poetry run python crawler/bing_daily_wallpaper.py
poetry run python crawler/bing_trending_images.py
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: |
pnpm install
pnpm lint:fix
if [ -n "$(git status --porcelain)" ]; then
echo "skip_commit=false" >> $GITHUB_ENV
else
echo "skip_commit=true" >> $GITHUB_ENV
fi
- name: Commit and push changes
if: env.skip_commit == 'false'
run: |
git config --global user.email "luz.liting@gmail.com"
git config --global user.name "litingyes"
git add .
git commit -m "chore(github-actions): update daily-wallpaper and trending-images at $(date +'%Y-%m-%d')"
git pull origin main -r
git push origin main
bing-search-images:
if: github.event.schedule == '0 0 * * 0'
name: update-bing-search-images
runs-on: ubuntu-latest
env:
AZURE_SUBSCRIPTION_KEY: ${{secrets.AZURE_SUBSCRIPTION_KEY}}
ALGOLIA_APPLICATION_ID: ${{secrets.ALGOLIA_APPLICATION_ID}}
ALGOLIA_WRITE_API_KEY: ${{secrets.ALGOLIA_WRITE_API_KEY}}
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: poetry
- run: poetry install
- run: poetry run python crawler/bing_search_wallpaper.py
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: |
pnpm install
pnpm lint:fix
if [ -n "$(git status --porcelain)" ]; then
echo "skip_commit=false" >> $GITHUB_ENV
else
echo "skip_commit=true" >> $GITHUB_ENV
fi
- name: Commit and push changes
if: env.skip_commit == 'false'
run: |
git config --global user.email "luz.liting@gmail.com"
git config --global user.name "litingyes"
git add .
git commit -m "chore(github-actions): update bing search images at $(date +'%Y-%m-%d')"
git pull origin main -r
git push origin main
emojis:
if: github.event.schedule == '0 0 1 * *'
name: update-emojis
runs-on: ubuntu-latest
env:
ALGOLIA_APPLICATION_ID: ${{secrets.ALGOLIA_APPLICATION_ID}}
ALGOLIA_WRITE_API_KEY: ${{secrets.ALGOLIA_WRITE_API_KEY}}
steps:
- uses: actions/checkout@v4
- run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: poetry
- run: poetry install
- run: poetry run python crawler/emojis.py
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: |
pnpm install
pnpm lint:fix
if [ -n "$(git status --porcelain)" ]; then
echo "skip_commit=false" >> $GITHUB_ENV
else
echo "skip_commit=true" >> $GITHUB_ENV
fi
- name: Commit and push changes
if: env.skip_commit == 'false'
run: |
git config --global user.email "luz.liting@gmail.com"
git config --global user.name "litingyes"
git add .
git commit -m "chore(github-actions): update emojis at $(date +'%Y-%m-%d')"
git pull origin main -r
git push origin main