Skip to content

Commit

Permalink
Create deploy pipeline
Browse files Browse the repository at this point in the history
Add pipeline for github actions
  • Loading branch information
frieZZerr committed Jun 3, 2024
1 parent 0fd4864 commit e4149a9
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy to Google Cloud

on:
push:
branches:
- project_10

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Authenticate in Google Cloud
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
run: |
gcloud auth login
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v0.2.0
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
project_id: ${{ secrets.GCP_PROJECT_ID }}

- name: Build and Push Docker images
run: |
gcloud auth configure-docker
docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/frontend:${{ github.sha }} ./project_10/client
docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/backend:${{ github.sha }} ./project_10/server
docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/frontend:${{ github.sha }}
docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/backend:${{ github.sha }}
- name: Deploy Frontend to Cloud Run
uses: google-github-actions/deploy-cloudrun@v0.2.0
with:
service: frontend-service
image: gcr.io/${{ secrets.GCP_PROJECT_ID }}/frontend:${{ github.sha }}
region: europe-central2

- name: Deploy Backend to Cloud Run
uses: google-github-actions/deploy-cloudrun@v0.2.0
with:
service: backend-service
image: gcr.io/${{ secrets.GCP_PROJECT_ID }}/backend:${{ github.sha }}
region: europe-central2

0 comments on commit e4149a9

Please sign in to comment.