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.