Skip to content

Workers build DB

Workers build DB #269

Workflow file for this run

name: Workers build DB
on:
schedule:
- cron: "0 0 * * *" # Adjust as needed
workflow_dispatch: # Allows manual trigger
repository_dispatch:
types: [payment_received] # Trigger from Stripe webhook
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-db:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- run: npm run database-git
- run: npm run database-stripe
env:
STRIPE_ENDPOINT_SECRET: ${{ secrets.STRIPE_ENDPOINT_SECRET }}
STRIPE_SECRET: ${{ secrets.STRIPE_SECRET }}
- run: npm run save-companies
- run: npm run save-jobs
- run: npm run processing-companies
- run: npm run processing-jobs
- run: npm run processing-stripe
# - run: npm run heatmap-agg
- run: npm run analyze-stats
- run: npm run optimize-database
- run: npm run generate-duckdb
- name: Prepare public folder
run: |
mkdir -p public
mv .db-sqlite/joblist.db public/
cp -r .db-duckdb/*.duckdb public/ || true
cp -r .db-duckdb/*.parquet public/ || true
- name: Generate index.html with redirect
run: |
cat > public/index.html << 'EOF'
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=./joblist.db">
</head>
</html>
EOF
- name: Verify files exist
run: |
echo "Contents of public directory:"
ls -la public/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sqlite-data
path: public/
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-db
if: always() && (needs.build-db.result == 'success')
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: sqlite-data
path: public/
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: public/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4