TechRadar AI Pipeline #79
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: TechRadar AI Pipeline | |
| on: | |
| schedule: | |
| - cron: '0 7 * * *' # 10:00 GMT+3 — GitHub Trending | |
| - cron: '0 11 * * *' # 14:00 GMT+3 — HuggingFace | |
| - cron: '0 15 * * *' # 18:00 GMT+3 — HackerNews / ArXiv | |
| workflow_dispatch: | |
| inputs: | |
| source: | |
| description: 'Source (all / github / github_trending / hackernews / huggingface / arxiv / producthunt)' | |
| required: false | |
| default: 'github_trending' | |
| enable_telegram: | |
| description: 'Publish to Telegram? (true/false)' | |
| required: false | |
| default: 'true' | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pipeline | |
| cancel-in-progress: true | |
| jobs: | |
| run-pipeline: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install system fonts | |
| run: sudo apt-get install -y fonts-dejavu-core | |
| - name: Install Python dependencies | |
| run: pip install -r requirements.txt | |
| - name: Run TechRadar pipeline | |
| timeout-minutes: 10 | |
| env: | |
| TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| TELEGRAM_CHANNEL_ID: ${{ secrets.TELEGRAM_CHANNEL_ID }} | |
| TELEGRAM_ADMIN_CHAT_ID: ${{ secrets.TELEGRAM_ADMIN_CHAT_ID }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | |
| NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }} | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| ENABLE_TELEGRAM: ${{ github.event.inputs.enable_telegram || 'true' }} | |
| ENABLE_WEBSITE: 'true' | |
| ENABLE_INSTAGRAM: 'false' | |
| ENABLE_REDDIT: 'false' | |
| ENABLE_TWITTER: 'false' | |
| ENABLE_LINKEDIN: 'false' | |
| WEBSITE_BASE_URL: 'https://nebula387.github.io/TechRadar' | |
| WEBSITE_OUTPUT_DIR: './website/public' | |
| MIN_SCORE: '85' | |
| MAX_POSTS_PER_DAY: '3' | |
| MAX_TELEGRAM_POSTS_PER_DAY: '1' | |
| run: | | |
| SOURCE="${{ github.event.inputs.source || 'github_trending' }}" | |
| python -m app.main --source "$SOURCE" | |
| - name: Commit feed.json, images and database | |
| run: | | |
| git config user.name "TechRadar AI Bot" | |
| git config user.email "techradar-bot@users.noreply.github.com" | |
| # Commit feed.json + images (binary data) + db; HTML rebuilt at deploy | |
| git add website/public/feed.json website/public/images/ data/techradar.db || true | |
| if git diff --staged --quiet; then | |
| echo "Nothing new to commit" | |
| else | |
| git commit -m "🤖 Auto-publish $(date -u '+%Y-%m-%d %H:%M UTC')" | |
| git push origin main | |
| fi | |
| deploy-pages: | |
| needs: run-pipeline | |
| if: always() | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install Python dependencies | |
| run: pip install -r requirements.txt | |
| - name: Rebuild website HTML from feed.json | |
| env: | |
| WEBSITE_BASE_URL: 'https://nebula387.github.io/TechRadar' | |
| WEBSITE_OUTPUT_DIR: './website/public' | |
| run: python -m app.rebuild_website | |
| - name: Setup GitHub Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload website artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './website/public' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |