AnyRouter 自动签到 #377
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: AnyRouter 自动签到 | |
on: | |
schedule: | |
- cron: '0 */6 * * *' | |
workflow_dispatch: | |
jobs: | |
checkin: | |
runs-on: windows-latest | |
environment: production | |
env: | |
PYTHONIOENCODING: utf-8 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: astral-sh/setup-uv@v3 | |
with: | |
version: "latest" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: 缓存 UV 依赖 | |
uses: actions/cache@v4 | |
id: uv-cache | |
with: | |
path: | | |
~/.cache/uv | |
.venv | |
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml', 'uv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-uv- | |
- name: 安装依赖 | |
if: steps.uv-cache.outputs.cache-hit != 'true' | |
run: | | |
echo "缓存未命中,开始安装项目依赖..." | |
uv sync | |
echo "✅ 环境初始化完成" | |
- name: 获取 Playwright 版本 | |
id: playwright-version | |
run: | | |
$version = uv run python -c "import importlib.metadata; print(importlib.metadata.version('playwright'))" | |
echo "version=$version" >> $env:GITHUB_OUTPUT | |
echo "Playwright version: $version" | |
- name: 缓存 Playwright 浏览器 | |
uses: actions/cache@v4 | |
id: playwright-cache | |
with: | |
path: ~\AppData\Local\ms-playwright | |
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }} | |
restore-keys: | | |
${{ runner.os }}-playwright- | |
- name: 安装 Playwright 浏览器 | |
if: steps.playwright-cache.outputs.cache-hit != 'true' | |
run: | | |
echo "缓存未命中,开始安装 Playwright 浏览器..." | |
uv run playwright install chromium --with-deps | |
- name: 恢复余额历史缓存 | |
uses: actions/cache@v4 | |
with: | |
path: balance_hash.txt | |
key: balance-hash-${{ github.sha }} | |
restore-keys: | | |
balance-hash- | |
- name: 执行签到 | |
env: | |
ANYROUTER_ACCOUNTS: ${{ secrets.ANYROUTER_ACCOUNTS }} | |
DINGDING_WEBHOOK: ${{ secrets.DINGDING_WEBHOOK }} | |
EMAIL_USER: ${{ secrets.EMAIL_USER }} | |
EMAIL_PASS: ${{ secrets.EMAIL_PASS }} | |
EMAIL_TO: ${{ secrets.EMAIL_TO }} | |
PUSHPLUS_TOKEN: ${{ secrets.PUSHPLUS_TOKEN }} | |
SERVERPUSHKEY: ${{ secrets.SERVERPUSHKEY }} | |
FEISHU_WEBHOOK: ${{ secrets.FEISHU_WEBHOOK }} | |
WEIXIN_WEBHOOK: ${{ secrets.WEIXIN_WEBHOOK }} | |
run: | | |
uv run checkin.py | |
- name: 执行结果 | |
if: always() | |
run: | | |
echo "签到任务执行完成" | |
echo "时间: $(Get-Date)" |