-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (55 loc) · 1.84 KB
/
auto_download.yml
File metadata and controls
69 lines (55 loc) · 1.84 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
68
69
name: auto download
on:
workflow_dispatch:
schedule:
- cron: '0 8 * * *'
# push:
# branches:
# - main
jobs:
build:
runs-on: ubuntu-latest
env:
BILIBILI_BACKUP_ENV: GITHUB_ACTION
# GITHUB_REPO_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
# REPO_NAME: ${{ github.event.repository.name }} # https://stackoverflow.com/questions/62803531/repository-name-as-a-github-action-environment-variable
# GITHUB_OWNER_REPO: ${{ github.repository }}
# LAST_SUCCESS_VIDEO_TIME: ${{ vars.LAST_SUCCESS_VIDEO_TIME }}
raw_config: ${{ secrets.raw_config }}
rclone_conf_content: ${{ secrets.rclone_conf_content }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x # 指定 Python 版本
- name: Install dependencies
run: pip install -r requirements.txt
- name: Uninstall bilix
run: |
pip uninstall -y bilix
- name: Install ffmpeg
run: sudo apt-get update && sudo apt-get install -y tree ffmpeg rclone
- name: Set up Rclone config
run: |
mkdir -p ~/.config/rclone
echo "$rclone_conf_content" | base64 --decode > ~/.config/rclone/rclone.conf
- name: Read Config from Secrets
id: read_config
run: |
echo $raw_config > .localconfig.json
- name: Run Python script
run: python main.py
- name: Setup GIT user
uses: fregante/setup-git-user@v1
- name: Save last success time
run: |
python encrypt_file.py
git add .
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Update last success time"
git push -f
fi