This commit is contained in:
Vaica committed 2026-03-13 12:24:47 +08:00
1 parent 52bc9c907c
commit 3948fb7820
2 files changed
+361 -68

No files matched your search

+26 -7
View File
@@ -5,17 +5,25 @@ on:
branches:
- main # 根据您的实际情况修改分支名称
schedule:
- cron: '0 1 */2 * *' # 北京时间每2天(48小时)早上9点执行
- cron: '0 1 * * *' # UTC 01:00 = 北京时间 09:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
env:
TZ: Asia/Shanghai
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
@@ -42,34 +50,42 @@ jobs:
run: npm ci
- name: Optimize Images
continue-on-error: true
run: node scripts/optimize_images.js
- name: Generate AI Comments
continue-on-error: true
env:
SILICONFLOW_API_KEY: ${{ secrets.SILICONFLOW_API_KEY }}
AI_PROVIDER: siliconflow
run: node scripts/ai_comment.js
- name: Commit Optimized Images and AI Comments
continue-on-error: true
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git add content/post
if ! git diff --staged --quiet; then
git commit -m "chore: auto-optimize images and generate ai comments [skip ci]"
git push
git fetch origin main
git rebase origin/main
git push origin HEAD:main
else
echo "No changes to commit"
fi
- name: Generate Friend Circle Data
continue-on-error: true
run: node scripts/generate_circle_data.js
- name: Check Link Status
continue-on-error: true
run: node scripts/check_links.js
- name: Read Failed Links Summary
continue-on-error: true
if: always()
run: |
if [ -f failed_links_summary.txt ]; then
@@ -89,6 +105,7 @@ jobs:
./scripts/deploy_edgeone.sh hugo-blog ./public overseas
- name: Debug Environment Variables
continue-on-error: true
run: |
echo "Bucket: ${{ secrets.UPYUN_BUCKET }}"
echo "Operator: ${{ secrets.UPYUN_OPERATOR }}"
@@ -117,20 +134,22 @@ jobs:
run: pip install requests
- name: Refresh DogeCloud CDN
continue-on-error: true
env:
DOGECLOUD_ACCESS_KEY: ${{ secrets.DOGECLOUD_ACCESS_KEY }}
DOGECLOUD_SECRET_KEY: ${{ secrets.DOGECLOUD_SECRET_KEY }}
CDN_URL_LIST: ${{ secrets.CDN_URL_LIST }}
run: python scripts/RefreshCDN.py
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S')"
- name: Generate Notification Report
continue-on-error: true
run: node scripts/generate_notification_report.js
- name: Send deployment success notification
- name: Get current date (CN)
id: date
run: echo "date=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
- name: Send deployment notification
if: success()
uses: dawidd6/action-send-mail@v3
with: