MRG: Merge pull request #125 from aerosense-ai/feature/add-support-fo… #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deploy the production cloud functions if pushing to the `main` branch or the test cloud functions if pushing to the | |
# `test` branch. | |
name: gcloud-deploy | |
on: | |
push: | |
branches: | |
- main | |
- test | |
jobs: | |
get-prefix: | |
runs-on: ubuntu-latest | |
outputs: | |
name_prefix: ${{ steps.prefix.outputs.name_prefix }} | |
dataset_name_prefix: ${{ steps.prefix.outputs.dataset_name_prefix }} | |
steps: | |
- name: Get prefix (test- or nothing for production) | |
id: prefix | |
run: | | |
echo ${{ github.ref }} | |
if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
echo "name_prefix=" >> $GITHUB_OUTPUT | |
echo "dataset_name_prefix=" >> $GITHUB_OUTPUT | |
else | |
echo "name_prefix=test-" >> $GITHUB_OUTPUT | |
echo "dataset_name_prefix=test_" >> $GITHUB_OUTPUT | |
fi | |
deploy-add-sensor-type: | |
permissions: | |
contents: "read" | |
id-token: "write" | |
runs-on: ubuntu-latest | |
needs: get-prefix | |
steps: | |
- id: checkout | |
uses: actions/checkout@v2 | |
- id: auth | |
uses: google-github-actions/auth@v0 | |
with: | |
workload_identity_provider: "projects/885434704038/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider" | |
service_account: "data-gateway-ci-testing@aerosense-twined.iam.gserviceaccount.com" | |
- uses: google-github-actions/deploy-cloud-functions@v0 | |
with: | |
description: Allows addition of a new sensor type whose values will be accepted into the database | |
entry_point: add_sensor_type | |
env_vars: BIG_QUERY_DATASET_NAME=${{ needs.get-prefix.outputs.dataset_name_prefix }}greta,COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION,DESTINATION_PROJECT_NAME=aerosense-twined | |
name: ${{ needs.get-prefix.outputs.name_prefix }}add-sensor-type | |
runtime: python39 | |
region: europe-west6 | |
service_account_email: as-ingress@aerosense-twined.iam.gserviceaccount.com | |
source_dir: cloud_functions | |
deploy-create-installation: | |
permissions: | |
contents: "read" | |
id-token: "write" | |
runs-on: ubuntu-latest | |
needs: get-prefix | |
steps: | |
- id: checkout | |
uses: actions/checkout@v2 | |
- id: auth | |
uses: google-github-actions/auth@v0 | |
with: | |
workload_identity_provider: "projects/885434704038/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider" | |
service_account: "data-gateway-ci-testing@aerosense-twined.iam.gserviceaccount.com" | |
- uses: google-github-actions/deploy-cloud-functions@v0 | |
with: | |
description: Allows creation of a new installation | |
entry_point: create_installation | |
env_vars: BIG_QUERY_DATASET_NAME=${{ needs.get-prefix.outputs.dataset_name_prefix }}greta,COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION,DESTINATION_PROJECT_NAME=aerosense-twined | |
name: ${{ needs.get-prefix.outputs.name_prefix }}create-installation | |
runtime: python39 | |
region: europe-west6 | |
service_account_email: as-ingress@aerosense-twined.iam.gserviceaccount.com | |
source_dir: cloud_functions | |
deploy-ingress-eu: | |
permissions: | |
contents: "read" | |
id-token: "write" | |
runs-on: ubuntu-latest | |
needs: get-prefix | |
steps: | |
- id: checkout | |
uses: actions/checkout@v2 | |
- id: auth | |
uses: google-github-actions/auth@v0 | |
with: | |
workload_identity_provider: "projects/885434704038/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider" | |
service_account: "data-gateway-ci-testing@aerosense-twined.iam.gserviceaccount.com" | |
- uses: google-github-actions/deploy-cloud-functions@v0 | |
with: | |
entry_point: upload_window | |
env_vars: BIG_QUERY_DATASET_NAME=${{ needs.get-prefix.outputs.dataset_name_prefix }}greta,COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION,DESTINATION_PROJECT_NAME=aerosense-twined,DESTINATION_BUCKET_NAME=data-gateway-processed-data,SOURCE_PROJECT_NAME=aerosense-twined | |
event_trigger_type: google.storage.object.finalize | |
event_trigger_resource: projects/_/buckets/${{ needs.get-prefix.outputs.name_prefix }}aerosense-ingress-eu | |
event_trigger_service: storage.googleapis.com | |
memory_mb: 1024 | |
name: ${{ needs.get-prefix.outputs.name_prefix }}ingress-eu | |
region: europe-west6 | |
runtime: python39 | |
service_account_email: as-ingress@aerosense-twined.iam.gserviceaccount.com | |
source_dir: cloud_functions |