Update db and deploy to gcloud run #30
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: Update db and deploy to gcloud run | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'data/**' | |
jobs: | |
run-update-script: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Read .python-version | |
run: echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run build_database.py | |
run: python src/chilean_humor/build_database.py | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GCP_SA_KEY }}' | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: Deploy to Cloud Run | |
run: |- | |
gcloud components install beta | |
gcloud config set run/region us-central1 | |
gcloud config set project chilean-humor | |
datasette publish cloudrun humor.db --service chilean-humor -m metadata.json --install=datasette-youtube-embed --install=datasette-block-robots --install datasette-auth-passwords --plugin-secret datasette-auth-passwords meruane_password_hash '${{ env.PASSWORD_HASH_1 }}' |