Skip to main content

Deploy All Views

๐Ÿ“„ <ENV> - [BigQuery] Deploy all viewsโ€‹

This GitHub Actions workflow allows developers to deploy all BigQuery views in bulk from a designated directory. It loops through each TypeScript view definition file and runs it using ts-node.


๐Ÿ“Œ Workflow Triggerโ€‹

This workflow is triggered manually via the GitHub actions from functions repo.


๐Ÿ’  Environment Variablesโ€‹

VariableDescription
GCP_PROJECT_IDGCP Project ID (e.g., biddirect-2)

๐Ÿงฑ๏ธ Workflow Job: deploy-bigquery-viewsโ€‹

StepDescription
Checkout repositoryClones the GitHub repository to the runner.
Set project env variableStores GCP_PROJECT_ID as a GitHub environment variable.
Authenticate with GCPUses the <ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNT secret to authenticate.
Set up Cloud SDKInstalls and configures the Google Cloud SDK CLI.
Install dependenciesInstalls Node.js dependencies in the functions directory.
Deploy all BigQuery viewsLoops through all .ts files in the views directory and executes each using ts-node.

๐Ÿงน View Scripts Directoryโ€‹

All BigQuery view scripts must be placed in:

functions/src/bqDataLake/definitions/views/

Each .ts file should contain the logic necessary to deploy its respective view to BigQuery.

Example:

functions/src/bqDataLake/definitions/views/accounts_latest_view.ts
functions/src/bqDataLake/definitions/views/accounts_serviceUnit_latest_view.ts

๐Ÿ” Required Secretsโ€‹

Secret NameDescription
<ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNTService account key JSON for GCP auth.

โœ… Example Usageโ€‹

To run this workflow:

  1. Navigate to the Actions tab in your GitHub repository.
  2. Select <ENV> - [BigQuery] Deploy all views.
  3. Click "Run workflow".

This will:

  • Authenticate with GCP
  • Loop through all view scripts in the target directory
  • Deploy each BigQuery view by executing its script using ts-node

This workflow simplifies the process of updating all BigQuery views in development and ensures all definitions are consistently deployed.