✨ Upgrade to PowerMem.ai style dark theme #8
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: Daily Report & Deploy | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' # 每天 UTC 00:00 | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| env: | |
| PYTHON_VERSION: '3.11' | |
| NODE_VERSION: '20' | |
| jobs: | |
| # Job 1: 生成报告(仅定时或手动触发) | |
| generate-report: | |
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: 📅 Get date | |
| id: date | |
| run: | | |
| echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT | |
| echo "year=$(date +%Y)" >> $GITHUB_OUTPUT | |
| echo "month=$(date +%m)" >> $GITHUB_OUTPUT | |
| - name: 🐍 Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: 📦 Install Python dependencies | |
| run: pip install -r requirements.txt | |
| - name: 🚀 Generate report | |
| env: | |
| LLM_API_KEY: ${{ secrets.LLM_API_KEY }} | |
| LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} | |
| LLM_MODEL: ${{ secrets.LLM_MODEL }} | |
| GITHUB_API_TOKEN: ${{ secrets.GITHUB_API_TOKEN }} | |
| run: python main.py --local --no-push | |
| - name: 📁 Move output to reports | |
| run: | | |
| DATE=${{ steps.date.outputs.date }} | |
| YEAR=${{ steps.date.outputs.year }} | |
| MONTH=${{ steps.date.outputs.month }} | |
| mkdir -p reports/$YEAR/$MONTH data/$YEAR/$MONTH | |
| cp output/$DATE.md reports/$YEAR/$MONTH/ 2>/dev/null || true | |
| cp output/$DATE.json data/$YEAR/$MONTH/ 2>/dev/null || true | |
| - name: 📤 Commit and push | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add reports/ data/ | |
| git diff --staged --quiet || git commit -m "📈 Add report for ${{ steps.date.outputs.date }}" | |
| git push | |
| - name: 📧 Send email notification | |
| if: success() | |
| uses: dawidd6/action-send-mail@v3 | |
| with: | |
| server_address: ${{ secrets.MAIL_SERVER }} | |
| server_port: ${{ secrets.MAIL_PORT }} | |
| username: ${{ secrets.MAIL_USERNAME }} | |
| password: ${{ secrets.MAIL_PASSWORD }} | |
| subject: "📈 GitHub Trending 日报 - ${{ steps.date.outputs.date }}" | |
| to: ${{ secrets.MAIL_TO }} | |
| from: GitHub Trending Reporter | |
| html_body: | | |
| <h1>📈 GitHub Trending 日报 - ${{ steps.date.outputs.date }}</h1> | |
| <p>今日报告已生成,点击下方链接查看完整内容:</p> | |
| <p><a href="https://wayyoungboy.github.io/github-trending-reporter/reports/${{ steps.date.outputs.year }}/${{ steps.date.outputs.month }}/${{ steps.date.outputs.date }}">📊 查看在线报告</a></p> | |
| <hr> | |
| <p><small>此邮件由 GitHub Trending Reporter 自动发送</small></p> | |
| attachments: output/${{ steps.date.outputs.date }}.md | |
| # Job 2: 构建部署网站 | |
| build-deploy: | |
| runs-on: ubuntu-latest | |
| needs: [generate-report] | |
| if: always() && (needs.generate-report.result == 'success' || needs.generate-report.result == 'skipped') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - name: 🔄 Pull latest changes | |
| run: git pull origin main | |
| - name: 🟢 Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: 📦 Install dependencies | |
| run: npm install | |
| - name: 🔧 Generate sidebar | |
| run: npm run generate-sidebar | |
| - name: 🏗️ Build | |
| run: npm run build | |
| - name: 📤 Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: build | |
| # Job 3: 部署到 GitHub Pages | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build-deploy | |
| steps: | |
| - name: 🚀 Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |