New location for the Misalignment Museum #81
This file contains 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: Build and deploy site | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install sqlite3 | |
run: sudo apt-get install sqlite3 | |
- uses: actions/cache@v1 | |
name: Configure pip caching | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Python dependencies | |
run: |- | |
pip install -r requirements.txt | |
- name: Fetch metadata for any new photos | |
run: |- | |
python fetch_photo_metadata.py | |
- name: Commit and push any new photos metadata | |
run: |- | |
git config user.name "Automated" | |
git config user.email "[email protected]" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "${timestamp}" || exit 0 | |
git pull --rebase | |
git push | |
- name: Build browse.db database | |
run: |- | |
wget https://niche-museums-j7hipcg4aq-uc.a.run.app/browse.db | |
./build.sh | |
- name: Set up Cloud Run | |
uses: google-github-actions/setup-gcloud@v0 | |
with: | |
version: '275.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 browse.db \ | |
--service niche-museums \ | |
--metadata metadata.yaml \ | |
--install=datasette-haversine \ | |
--install=datasette-pretty-json \ | |
--install=datasette-template-sql>=1.0.2 \ | |
--install=datasette-json-html \ | |
--install=datasette-render-markdown \ | |
--install=datasette-cluster-map>=0.17.1 \ | |
--install=datasette-atom>=0.6 \ | |
--install=datasette-debug-asgi \ | |
--template-dir=templates \ | |
--plugins-dir=plugins \ | |
--static static:static/ \ | |
--extra-options "--config force_https_urls:1" |