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โ
| Variable | Description |
|---|---|
GCP_PROJECT_ID | GCP Project ID (e.g., biddirect-2) |
๐ Job: deploy-bigquery-viewโ
| Step | Description |
|---|---|
| Checkout repository | Clones the repository to the runner. |
| Set project env variable | Adds GCP_PROJECT_ID to GitHub environment variables. |
| Authenticate with GCP | Authenticates using a service account (<ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNT) stored in GitHub Secrets. |
| Set up Cloud SDK | Installs and configures the Google Cloud CLI. |
| Install dependencies | Runs npm install inside the functions directory. |
| Deploy BigQuery view | Executes 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 Name | Description |
|---|---|
<ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNT | Service account key JSON for GCP auth. |
โ Example Usageโ
To run this workflow:
- Go to the Actions tab in your GitHub repository.
- Select the workflow
<ENV> - [BigQuery] Deploy view. - Click "Run workflow".
- Enter the
view_name(e.g.,accounts_latest_view). - 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.