Skip to content

Commit

Permalink
Merge branch 'civil' into feature/nightly-action
Browse files Browse the repository at this point in the history
  • Loading branch information
antidipyramid authored Dec 18, 2023
2 parents 5917293 + edfdef7 commit 834d9d9
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
99 changes: 99 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Full case scrape

on:
workflow_dispatch:
# schedule:
# - cron: '15 4 * * *'

jobs:
# build:
# runs-on: ubuntu-latest
#
# steps:
# - name: Set current date as env variable
# run: echo "BEGIN_COURTS_RUN=$(date +'%s')" >> $GITHUB_ENV
# - uses: actions/checkout@v2
# - name: upgrade sqlite3
# run: |
# sudo add-apt-repository ppa:linuxgndu/sqlitebrowser-testing
# sudo apt-get update
# sudo apt-get install sqlite3
#
# - name: Install requirements
# run: pip install -r requirements.txt
#
# - name: Build database
# run: |
# echo $BEGIN_COURTS_RUN
# make cases.db
#
# - name: Setup asset
# run: |
# zip -p ${{ secrets.CASE_DB_PW }} cases.db.zip cases.db
#
# - name: Release
# uses: WebFreak001/deploy-nightly@v3.0.0
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: https://uploads.github.com/repos/datamade/court-scrapers/releases/131985702/assets{?name,label}
# release_id: 131985702
# asset_path: ./cases.db.zip
# asset_name: cases.db.zip
# asset_content_type: application/zip # required by GitHub API
# max_releases: 7
# - name: keepalive
# uses: gautamkrishnar/keepalive-workflow@v1

deploy:
runs-on: ubuntu-latest

env:
HEROKU_ORGANIZATION: ${{ secrets.HEROKU_ORG }}

steps:
- uses: actions/checkout@v3

- name: Install requirements
run: pip install -r requirements.txt

- name: Download latest database zip
uses: robinraju/release-downloader@v1.8
with:
tag: "nightly"
fileName: "*.db.zip"

- name: Decrypt database
run: |
unzip -P "${{ secrets.CASE_DB_PW }}" cases.db.zip
- name: Install heroku-builds plugin
run: |
heroku plugins:install heroku-builds
- name: Login to Heroku CLI
uses: akhileshns/heroku-deploy@v3.12.14
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ""
heroku_email: ${{ secrets.HEROKU_EMAIL }}
justlogin: true

- name: Install Datasette plugins
run: |
datasette install datasette-auth-passwords datasette-auth-tokens
- name: Get hashed Datasette password
run: |
# Store hash as an environment variable
hash=$(echo "${{ secrets.DATASETTE_INSTANCE_PW }}" \
| datasette hash-password --no-confirm); \
echo "hash=$hash" >> $GITHUB_ENV
- name: Deploy Datasette instance to Heroku
run: |
datasette publish heroku cases.db \
-n court-scraper \
-m metadata.json \
--install datasette-auth-passwords \
--plugin-secret datasette-auth-passwords root_password_hash '${{ env.hash }}'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ datasette
csvs-to-sqlite
sqlite-utils
csvkit
sqlean.py
sqlean.py

0 comments on commit 834d9d9

Please sign in to comment.