Skip to content

Generate and Deploy Report #432

Generate and Deploy Report

Generate and Deploy Report #432

name: Generate and Deploy Report
on:
schedule:
# Run every 12 hours at 00:00 and 12:00 UTC
- cron: '0 */12 * * *'
workflow_dispatch: # Allow manual trigger
push:
branches:
- main
jobs:
generate-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build TypeScript
run: npm run build
- name: Generate and upload report
env:
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
S3_BUCKET: ${{ secrets.S3_BUCKET }}
S3_REGION: ${{ secrets.S3_REGION }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
VERCEL_URL: ${{ secrets.VERCEL_URL }}
UPLOAD_SECRET: ${{ secrets.UPLOAD_SECRET }}
run: |
mkdir -p reports
# The app will automatically upload to Vercel if VERCEL_URL and UPLOAD_SECRET are set
npm start
- name: Upload report as artifact (backup)
uses: actions/upload-artifact@v4
with:
name: optimization-report-${{ github.run_number }}
path: reports/*.html
retention-days: 7