Skip to content

MRG: Merge pull request #12 from octue/update #30

MRG: Merge pull request #12 from octue/update

MRG: Merge pull request #12 from octue/update #30

Workflow file for this run

# Deploy the production cloud function 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 }}
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
else
echo "name_prefix=test-" >> $GITHUB_OUTPUT
fi
deploy-api:
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
needs: get-prefix
steps:
- id: checkout
uses: actions/checkout@v4
- id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: "projects/406572174402/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider"
service_account: "github-actions@windeurope72-private.iam.gserviceaccount.com"
- name: Get SecretManager prefix
id: secrets_prefix
run: |
echo "prefix=projects/406572174402/secrets/octue-elevations-populator-private-main" >> $GITHUB_OUTPUT
- uses: google-github-actions/deploy-cloud-functions@v3
with:
name: ${{ needs.get-prefix.outputs.name_prefix }}elevations-api
runtime: python310
env_vars: COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION
memory_mb: 1024
region: europe-west1
service_account_email: elevations-api@windeurope72-private.iam.gserviceaccount.com
source_dir: elevations_api
entry_point: get_or_request_elevations
secret_environment_variables: NEO4J_URI=${{ steps.secrets_prefix.outputs.prefix }}-neo4j-uri,NEO4J_USERNAME=${{ steps.secrets_prefix.outputs.prefix }}-neo4j-username,NEO4J_PASSWORD=${{ steps.secrets_prefix.outputs.prefix }}-neo4j-password
https_trigger_security_level: secure_always
min_instances: 0
max_instances: 10
timeout: 300