feat: Add infrastructure-as-code (IaC) and GitHub Actions workflow #1
This file contains hidden or 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
name: Deploy to Cloud Run | |
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: google-github-actions/setup-gcloud@v0 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
- name: Authorize Docker to push to Google Container Registry | |
run: gcloud auth configure-docker | |
- name: Build and Push Docker Image | |
run: | | |
docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/gemini-sre-agent . | |
docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/gemini-sre-agent | |
- name: Deploy to Cloud Run | |
run: | | |
gcloud run deploy gemini-sre-agent \ | |
--image gcr.io/${{ secrets.GCP_PROJECT_ID }}/gemini-sre-agent \ | |
--region us-central1 \ | |
--platform managed \ | |
--allow-unauthenticated \ | |
--set-env-vars=GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} |