forked from tachiyomiorg/user-agents
-
Notifications
You must be signed in to change notification settings - Fork 3
63 lines (54 loc) · 1.76 KB
/
update.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
name: Update latest user agents
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * MON'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Update latest user agents
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
with:
node-version: 18
- name: Check cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
id: npm-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm install
- name: Scrape user agents
run: npm run start
- name: Checkout gh-pages branch
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
ref: gh-pages
path: gh-pages
- name: Move build files to repo folder
run: rsync -a --delete --exclude .git --exclude .nojekyll --exclude index.html build/ gh-pages/
- name: Push repo changes
run: |
cd gh-pages
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Update user agents"
git push
else
echo "No changes to commit"
fi