zhizhi/.github/workflows/sync-deploy-to-notion.yml

52 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# .github/workflows/sync-deploy-to-notion.yml
# 📝 定时同步部署状态到 Notion · 铸渊 · 光湖代码守护人格体
# 每天两次: 04:00 + 14:00 UTC北京 12:00 + 22:00
name: "📝 Sync Deploy Status to Notion"
on:
schedule:
- cron: '0 4,14 * * *'
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "🧠 唤醒铸渊核心大脑"
run: |
echo "🧠 铸渊核心大脑唤醒中..."
echo "🔑 扫描 Secrets 权限..."
for KEY in NOTION_TOKEN FINGERPRINT_DB_ID SMTP_USER; do
if [ -z "$(eval echo \$$KEY)" ]; then
echo "⚠️ 缺失: $KEY"
else
echo "✅ 可用: $KEY"
fi
done
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
FINGERPRINT_DB_ID: ${{ secrets.FINGERPRINT_DB_ID }}
SMTP_USER: ${{ secrets.SMTP_USER }}
- name: "📝 同步部署状态到 Notion"
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
FINGERPRINT_DB_ID: ${{ secrets.FINGERPRINT_DB_ID }}
run: |
node scripts/sync-deploy-to-notion.js
- name: "🔥 远程冒烟检查"
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
mkdir -p ~/.ssh
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H $DEPLOY_HOST >> ~/.ssh/known_hosts 2>/dev/null
scp scripts/smoke-test.sh ${DEPLOY_USER}@${DEPLOY_HOST}:/tmp/smoke-test.sh
ssh ${DEPLOY_USER}@${DEPLOY_HOST} "bash /tmp/smoke-test.sh"