Skip to content

Merge pull request #15 from RedrockTeam/fix/mirror-asset-query #12

Merge pull request #15 from RedrockTeam/fix/mirror-asset-query

Merge pull request #15 from RedrockTeam/fix/mirror-asset-query #12

Workflow file for this run

name: Mirror friend blogs & deploy
on:
push:
branches: ["main"]
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages-mirror
cancel-in-progress: true
jobs:
mirror-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Restore mirror cache
uses: actions/cache@v4
with:
path: .cache
# 稳定 key:每次成功运行覆盖同一个缓存条目,避免堆积 370MB 级快照,
# 并保证增量状态(.cache/state)在下次运行一定能恢复
# 媒体改为直链后缓存只有 HTML/CSS/JS,换前缀作废旧的大缓存
key: mirror-hotlink-${{ hashFiles('src/data/channels.json') }}
restore-keys: |
mirror-hotlink-
- name: Mirror and sanitize
run: node scripts/mirror.mjs
- name: Build Astro site
run: npm run build
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4