Prechádzať zdrojové kódy

Add GitHub Actions workflow for Pages deployment

Thomas Knott 1 týždeň pred
rodič
commit
619a2f9299
1 zmenil súbory, kde vykonal 70 pridanie a 0 odobranie
  1. 70 0
      .github/workflows/deploy.yml

+ 70 - 0
.github/workflows/deploy.yml

@@ -0,0 +1,70 @@
+name: Hourly Data Refresh & Deploy
+
+# 1. When should this action run?
+on:
+  schedule:
+    - cron: "0 * * * *" # Runs at minute 0 of every hour
+  workflow_dispatch:    # Allows you to click a "Run" button manually in GitHub
+  push:
+    branches:
+      - main            # Also runs automatically when you push new code to the 'main' branch
+
+# 2. Grant permissions so the action can publish to GitHub Pages
+permissions:
+  contents: read
+  pages: write
+  id-token: write
+
+# 3. Ensure we don't run multiple deployments at the exact same time
+concurrency:
+  group: "pages"
+  cancel-in-progress: false
+
+# 4. The actual sequence of commands
+jobs:
+  build-and-deploy:
+    environment:
+      name: github-pages
+      url: ${{ steps.deployment.outputs.page_url }}
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout Repository
+        uses: actions/checkout@v4
+
+      # Setup our tools
+      - name: Install uv
+        uses: astral-sh/setup-uv@v5
+        
+      - name: Set up Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3.13' # Based on your pyproject.toml
+
+      - name: Setup Bun
+        uses: oven-sh/setup-bun@v1
+        with:
+          bun-version: latest
+
+      # Run the exact sequence from your dev.sh script
+      - name: Generate Backend Data (Python)
+        run: uv run roi.py
+
+      - name: Install Frontend Dependencies (Bun)
+        run: bun install
+
+      - name: Build Frontend (Bun)
+        run: bun run build
+
+      # Package the 'www' folder and send it to GitHub Pages
+      - name: Setup GitHub Pages
+        uses: actions/configure-pages@v5
+
+      - name: Upload artifact
+        uses: actions/upload-pages-artifact@v3
+        with:
+          path: './www' 
+
+      - name: Deploy to GitHub Pages
+        id: deployment
+        uses: actions/deploy-pages@v4