Skip to content

Commit

Permalink
Enable deploy on pr (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
therefromhere authored Oct 14, 2023
1 parent 108d9da commit 56b0c12
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
name: Deploy
on: [push]
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
concurrency: "prod"
steps:
- uses: 'actions/checkout@v4'
- id: 'auth'
Expand All @@ -14,8 +21,19 @@ jobs:
with:
workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}
- uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Run image
uses: abatilo/actions-poetry@v2
- name: Generate Requirements
run: poetry export --output=requirements.txt
- id: 'deploy'
uses: 'google-github-actions/deploy-cloud-functions@v1'
with:
name: ${{ vars.GCP_CLOUD_FUNCTION_NAME }}
runtime: 'python310'
runtime: 'python311'
entry_point: "update"
# TODO put these all in github or all in gcp
env_vars: DEVICE_ID=${{ vars.DEVICE_ID}}
secret_environment_variables: ASTRAL_LOCATION=projects/${{ steps.auth.outputs.project_id}}/secrets/ASTRAL_LOCATION/versions/latest,SUREPY_AUTH_TOKEN=projects/${{ steps.auth.outputs.project_id}}/secrets/SUREPY_AUTH_TOKEN/versions/latest
5 changes: 4 additions & 1 deletion scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash

./scripts/generate_requirements.sh
gcloud functions deploy update --runtime=python311 --trigger-http --env-vars-file=.env_vars.yaml --project=$GOOGLE_CLOUD_PROJECT
gcloud functions deploy update --runtime=python311 \
--trigger-http --env-vars-file=.env_vars.yaml \
--set-secrets=ASTRAL_LOCATION=projects/$GOOGLE_CLOUD_PROJECT/secrets/ASTRAL_LOCATION:latest,SUREPY_AUTH_TOKEN=projects/$GOOGLE_CLOUD_PROJECT/secrets/SUREPY_AUTH_TOKEN:latest \
--project=$GOOGLE_CLOUD_PROJECT

0 comments on commit 56b0c12

Please sign in to comment.