Publish Intelligent Advisory Site #16
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: Publish Model Recommendations Site | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| as_of: | |
| description: "Report date. Defaults to current UTC date when empty." | |
| required: false | |
| type: string | |
| site_url: | |
| description: "Public site URL used in RSS links." | |
| required: false | |
| default: "https://quantstrategylab.github.io/QuantAdvisorResearch" | |
| type: string | |
| political_events_path: | |
| description: "Path inside PoliticalEventTrackingResearch." | |
| required: false | |
| default: "examples/political_events.example.csv" | |
| type: string | |
| political_watchlist_path: | |
| description: "Path inside PoliticalEventTrackingResearch." | |
| required: false | |
| default: "examples/political_watchlist.example.csv" | |
| type: string | |
| ai_signal_path: | |
| description: "Path inside AiLongHorizonSignalPipelines." | |
| required: false | |
| default: "data/output/latest_signal.json" | |
| type: string | |
| theme_momentum_path: | |
| description: "Optional path inside AiLongHorizonSignalPipelines. Empty disables theme momentum context." | |
| required: false | |
| default: "data/output/theme_momentum_snapshot.json" | |
| type: string | |
| schedule: | |
| - cron: "0 13 * * 6" | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-site: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout advisor repository | |
| uses: actions/checkout@v6 | |
| with: | |
| path: advisor | |
| - name: Checkout political event repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: QuantStrategyLab/PoliticalEventTrackingResearch | |
| path: political-events | |
| - name: Checkout AI shadow repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: QuantStrategyLab/AiLongHorizonSignalPipelines | |
| path: ai-long-horizon | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install advisor package | |
| working-directory: advisor | |
| run: python -m pip install -e . | |
| - name: Build report and static site | |
| id: build_report | |
| working-directory: advisor | |
| env: | |
| INPUT_AS_OF: ${{ github.event.inputs.as_of || '' }} | |
| SITE_URL: ${{ github.event.inputs.site_url || 'https://quantstrategylab.github.io/QuantAdvisorResearch' }} | |
| POLITICAL_EVENTS_PATH: ${{ github.event.inputs.political_events_path || 'examples/political_events.example.csv' }} | |
| POLITICAL_WATCHLIST_PATH: ${{ github.event.inputs.political_watchlist_path || 'examples/political_watchlist.example.csv' }} | |
| AI_SIGNAL_PATH: ${{ github.event.inputs.ai_signal_path || 'data/output/latest_signal.json' }} | |
| THEME_MOMENTUM_PATH: ${{ github.event.inputs.theme_momentum_path || 'data/output/theme_momentum_snapshot.json' }} | |
| run: | | |
| set -euo pipefail | |
| AS_OF="${INPUT_AS_OF:-$(date -u +%F)}" | |
| mkdir -p data/output/published site | |
| THEME_ARGS=() | |
| if [ -n "${THEME_MOMENTUM_PATH}" ] && [ -f "../ai-long-horizon/${THEME_MOMENTUM_PATH}" ]; then | |
| THEME_ARGS=(--theme-momentum "../ai-long-horizon/${THEME_MOMENTUM_PATH}") | |
| fi | |
| python scripts/build_advisory_report.py \ | |
| --as-of "${AS_OF}" \ | |
| --cadence weekly \ | |
| --political-events "../political-events/${POLITICAL_EVENTS_PATH}" \ | |
| --political-watchlist "../political-events/${POLITICAL_WATCHLIST_PATH}" \ | |
| --ai-signal "../ai-long-horizon/${AI_SIGNAL_PATH}" \ | |
| "${THEME_ARGS[@]}" \ | |
| --output-json "data/output/published/advisory_report_${AS_OF}.json" \ | |
| --output-md "data/output/published/advisory_report_${AS_OF}.md" | |
| python scripts/publish_advisory_site.py \ | |
| --reports "data/output/published/advisory_report_${AS_OF}.json" \ | |
| --output-dir site \ | |
| --site-url "${SITE_URL}" \ | |
| --feed-title "量化模型推荐" | |
| cp "data/output/published/advisory_report_${AS_OF}.json" site/ | |
| cp "data/output/published/advisory_report_${AS_OF}.md" site/ | |
| cp "data/output/published/advisory_report_${AS_OF}.json.manifest.json" site/ | |
| echo "as_of=${AS_OF}" >> "$GITHUB_OUTPUT" | |
| echo "report_path=data/output/published/advisory_report_${AS_OF}.json" >> "$GITHUB_OUTPUT" | |
| - name: Upload site artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: model-recommendations-site | |
| path: advisor/site | |
| if-no-files-found: error | |
| - name: Configure Pages | |
| uses: actions/configure-pages@v6 | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: advisor/site | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 | |
| - name: Notify Telegram subscribers | |
| if: ${{ success() }} | |
| continue-on-error: true | |
| working-directory: advisor | |
| env: | |
| TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
| SITE_URL: ${{ github.event.inputs.site_url || 'https://quantstrategylab.github.io/QuantAdvisorResearch' }} | |
| REPORT_PATH: ${{ steps.build_report.outputs.report_path }} | |
| run: | | |
| set -euo pipefail | |
| python scripts/notify_advisory_telegram.py \ | |
| --report "${REPORT_PATH}" \ | |
| --site-url "${SITE_URL}" |