Skip to content

Run the Materialized Views Function #211

Run the Materialized Views Function

Run the Materialized Views Function #211

---
name: Run the Materialized Views Function
on:
schedule:
# Invoke at 6 UTC EST every day
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
environment:
required: true
type: choice
description: The environment the workflow should run on.
options:
- dev
- staging
- preview
- production
jobs:
scheduled-materialized-views:
if: ${{ github.event_name == 'schedule' }}
strategy:
matrix:
environments: ["dev", "staging", "production"]
name: Run materialized views create on ${{ inputs.environment }}
runs-on: ubuntu-latest
environment: ${{ matrix.environments }}
env:
space: ${{ matrix.environments }}
steps:
- name: Run Command
uses: cloud-gov/cg-cli-tools@main
with:
cf_username: ${{ secrets.CF_USERNAME }}
cf_password: ${{ secrets.CF_PASSWORD }}
cf_org: gsa-tts-oros-fac
cf_space: ${{ env.space }}
command: cf run-task gsa-fac -k 2G -m 2G --name scheduled_create_materialized_views --command "python manage.py materialized_views --create"
dispatch-materialized-views:
if: ${{ github.event.inputs.environment != '' }}
name: Run materialized views create on ${{ inputs.environment }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
space: ${{ inputs.environment }}
steps:
- name: Run Command
uses: cloud-gov/cg-cli-tools@main
with:
cf_username: ${{ secrets.CF_USERNAME }}
cf_password: ${{ secrets.CF_PASSWORD }}
cf_org: gsa-tts-oros-fac
cf_space: ${{ env.space }}
command: cf run-task gsa-fac -k 2G -m 2G --name dispatch_create_materialized_views --command "python manage.py materialized_views --create"