Add action to publish to Heroku #5
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: Full case scrape | |
on: | |
workflow_dispatch: | |
pull_request: | |
# 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/[email protected] | |
# 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 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install requirements | |
run: pip install -r requirements.txt | |
- name: Download latest database zip | |
uses: robinraju/[email protected] | |
with: | |
tag: "nightly" | |
fileName: "*.db.zip" | |
- name: Decrypt database | |
run: | | |
unzip -P ${{ secrets.CASE_DB_PW }} cases.db.zip | |
- 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 ${{ secrets.DATASETTE_INSTANCE_PW }} |