Skip to content

Build and deploy demos #1055

Build and deploy demos

Build and deploy demos #1055

Workflow file for this run

name: Build and deploy demos
on:
workflow_dispatch:
schedule:
- cron: "5 1 * * *"
push:
paths:
- ".github/workflows/deplay-demos.yml"
jobs:
build_and_deploy_demos:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Check out simonw/ca-fires-history
uses: actions/checkout@v2
with:
repository: simonw/ca-fires-history
path: ca-fires-history
- name: Check out simonw/pge-outages
uses: actions/checkout@v2
with:
repository: simonw/pge-outages
path: pge-outages
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: pip
- name: Install Python dependencies
run: |
pip install s3-credentials datasette
pip install -e '.'
- name: Download pge-outages.db
run: curl --fail -o pge-outages.db https://s3.amazonaws.com/git-history-demos/pge-outages.db
continue-on-error: true
- name: Download ca-fires.db
run: curl --fail -o ca-fires.db https://s3.amazonaws.com/git-history-demos/ca-fires.db
continue-on-error: true
- name: Build the databases
run: |-
demos/pge-outages.sh
demos/ca-fires.sh
- name: Upload databases to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |-
s3-credentials put-object git-history-demos pge-outages.db pge-outages.db
s3-credentials put-object git-history-demos ca-fires.db ca-fires.db
- name: Set up Cloud Run
uses: google-github-actions/setup-gcloud@v0
with:
version: '318.0.0'
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Deploy to Cloud Run
run: |-
gcloud config set run/region us-central1
gcloud config set project datasette-222320
datasette publish cloudrun \
--service git-history-demos \
pge-outages.db \
ca-fires.db \
--install datasette-block-robots \
--install datasette-remote-metadata \
--install datasette-cluster-map \
--install datasette-vega \
--install datasette-atom \
--install datasette-render-timestamps \
-m demos/metadata.yml \
--branch main \
--memory 4Gi