Skip to main content

Deploy View

πŸ“„ <ENV> - [BigQuery] Deploy view​

This GitHub Actions workflow allows developers to manually deploy a BigQuery view by executing a TypeScript script. It authenticates using a service account and triggers the view deployment logic.


πŸ“Œ Workflow Trigger​

This workflow is triggered manually via the GitHub actions in function repo

Required Input:​

  • view_name (string): The name of the view to be deployed.

πŸ’  Environment Variables​

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


πŸš€ Job: deploy-bigquery-view​

StepDescription
Checkout repositoryClones the repository to the runner.
Set project env variableAdds GCP_PROJECT_ID to GitHub environment variables.
Authenticate with GCPAuthenticates using a service account (<ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNT) stored in GitHub Secrets.
Set up Cloud SDKInstalls and configures the Google Cloud CLI.
Install dependenciesRuns npm install inside the functions directory.
Deploy BigQuery viewExecutes the specified TypeScript file using ts-node.

🧹 View Script Location​

All view definitions should be located at:

functions/src/bqDataLake/definitions/views/

The input view_name should match the file name (without .ts).

Example:

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

To deploy: use accounts_latest_view as the input.


πŸ” Required Secrets​

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

βœ… Example Usage​

To run this workflow:

  1. Go to the Actions tab in your GitHub repository.
  2. Select the workflow <ENV> - [BigQuery] Deploy view.
  3. Click "Run workflow".
  4. Enter the view_name (e.g., accounts_latest_view).
  5. Click "Run workflow".

This will execute:

npx ts-node functions/src/bqDataLake/definitions/views/accounts_latest_view.ts

and deploy the BigQuery view as defined in the script.