forked from willow-god/Friend-Circle-Lite
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (80 loc) · 2.56 KB
/
friend_circle_lite.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
name: Friend Circle Lite
on:
schedule:
- cron: "0 */4 * * *"
workflow_dispatch:
env:
TZ: Asia/Shanghai
jobs:
friend-circle-lite:
runs-on: ubuntu-latest
steps:
- name: Pull Latest Repository
uses: actions/checkout@v4
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Download last_articles.json artifact
uses: dawidd6/action-download-artifact@v6
with:
github_token: ${{secrets.GITHUB_TOKEN}}
branch: main
name: 'last_articles'
path: './rss_subscribe'
if_no_artifact_found: warn
- name: Check RSS feeds
env:
SMTP_PWD: ${{ secrets.SMTP_PWD }}
FCL_REPO: ${{ github.repository }}
run: |
echo "Checking RSS feeds..."
python run.py
- name: Upload last_articles.json as artifact
uses: actions/upload-artifact@v4
with:
name: 'last_articles'
path: './rss_subscribe/last_articles.json'
retention-days: 90
- name: git config
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Commit changes
run: |
mkdir pages
cp -r main ./static/index.html ./static/readme.md ./static/favicon.ico ./static/bg-light.webp ./static/bg-dark.webp all.json errors.json pages/
cd pages
git init
git add .
git commit -m "⏱️ $(date +"%Y年%m月%d日-%H时%M分") GitHub Actions定时更新"
git push --force https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:page
- name: Delete Workflow Runs
uses: Mattraks/delete-workflow-runs@v2
with:
retain_days: 30
keep_minimum_runs: 6
keepalive-workflow:
name: Keepalive Workflow
if: ${{ always() }}
needs: friend-circle-lite
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@v4
- uses: gautamkrishnar/keepalive-workflow@v2
with:
committer_username: "github-actions[bot]"
committer_email: "github-actions[bot]@users.noreply.github.com"