Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable deploy on pr #6

Merged
merged 27 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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