-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (64 loc) · 1.82 KB
/
Copy pathDeployToGithubPages.yml
File metadata and controls
68 lines (64 loc) · 1.82 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
name: Deploy To Github Pages
on:
watch:
types: [started]
push:
branches:
- main
schedule:
- cron: "0 */1 * * *"
workflow_dispatch:
jobs:
deploy:
if: github.repository == 'MHG-LAB/RSSBOX'
name: Deploy Hexo Public To Pages
runs-on: ubuntu-latest
env:
TZ: Asia/Shanghai
steps:
- name: Checkout Repository main branch
uses: actions/checkout@main
with:
submodules: "true"
- name: Setup Node.js
uses: actions/setup-node@main
with:
node-version: "24.x"
- name: Setup Python 3
uses: actions/setup-python@main
with:
python-version: '3.12'
architecture: 'x64'
- name: Install Globel Dependencies
run: |
npm install hexo-cli@4 -g
pip install -r requirements.txt
- name: Cache node modules
uses: actions/cache@main
id: cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
npm install
- name: Crawl
run: |
rm -rf source/_posts
python main.py ${{ secrets.CORS_API }} ${{ secrets.RSSHUB_API }} ${{ secrets.OLD_RSSHUB_API }}
- name: Generate Public Files
run: |
# Restore last modified time
git ls-files -z | while read -d '' path; do touch -d "$(git log -1 --format="@%ct" "$path")" "$path"; done
npm run start
- name: Deploy Github
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
force_orphan: true