-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (109 loc) · 3.51 KB
/
Copy pathdeploy.yml
File metadata and controls
136 lines (109 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Daily AI Updates & Deploy to GitHub Pages
on:
# Run daily at 6 AM UTC (once per day)
schedule:
- cron: '0 6 * * *'
# Allow manual trigger
workflow_dispatch:
# Run on push to main
push:
branches: [ main ]
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Job 1: Generate AI content
generate-content:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
pip install yfinance pandas numpy scipy matplotlib
- name: Run Moore Analysis
run: |
python market_analysis.py
- name: Generate AI digest and insights
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
run: |
# Create a simple Node.js script to generate content
cat > generate.js << 'EOF'
const fs = require('fs');
const apiKey = process.env.OPENROUTER_API_KEY || '';
const timestamp = new Date().toISOString();
// Inject API key into app.js
let appContent = fs.readFileSync('app.js', 'utf8');
// Replace the API key placeholder
appContent = appContent.replace(
"apiKey: window.OPENROUTER_API_KEY || ''",
`apiKey: '${apiKey}'`
);
fs.writeFileSync('app.js', appContent);
console.log('✅ API key injected successfully');
console.log(`📅 Generated at: ${timestamp}`);
EOF
node generate.js
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: updated-app
path: |
index.html
styles.css
app.js
manifest.json
service-worker.js
icons/
README.md
market_analysis.json
market_analysis_chart.png
retention-days: 1
# Job 2: Deploy to GitHub Pages
deploy:
needs: generate-content
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: updated-app
path: .
- name: Setup Pages
uses: actions/configure-pages@v4
with:
enablement: true
- name: Upload to Pages
uses: actions/upload-pages-artifact@v3
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Summary
run: |
echo "## 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ **Status**: Successfully deployed" >> $GITHUB_STEP_SUMMARY
echo "🌐 **URL**: ${{ steps.deployment.outputs.page_url }}" >> $GITHUB_STEP_SUMMARY
echo "📅 **Time**: $(date)" >> $GITHUB_STEP_SUMMARY
echo "🤖 **AI**: Content updated with fresh insights" >> $GITHUB_STEP_SUMMARY