Skip to content

ci : updates

ci : updates #13

Workflow file for this run

name: 🏓 backend-cd
# on:
# push:
# branches:
# - main
on:
push:
branches:
- main
pull_request:
branches:
- main
defaults:
run:
working-directory: ./backend
env:
REGION: ${{ secrets.REGION }}
REPO_NAME: ${{ secrets.REPO_NAME }}
SERVICE_NAME : ${{ secrets.SERVICE_NAME }}
CONTAINER_NAME: ${{ secrets.CONTAINER_NAME }}
jobs:
backend-deploy:
name: 🚀 Deploy to production
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: arunavabasu03
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GCP
uses: "google-github-actions/auth@v2"
with:
project_id: $REPO_NAME
credentials_json: "${{ secrets.CLOUD_RUN_SERVICE_ACCOUNT }}"
- name: Set up Cloud SDK
uses: "google-github-actions/setup-gcloud@v2"
- name: Build Docker image
run: |
docker build -t $CONTAINER_NAME:${{ github.sha }} -t $CONTAINER_NAME:latest .
- name: Push Docker image
run: |
docker push $CONTAINER_NAME:${{ github.sha }} && docker push $CONTAINER_NAME:latest
# - name: Deploy to Cloud Run
# run: |
# gcloud run deploy $SERVICE_NAME \
# --image $CONTAINER_NAME:latest \
# --platform managed \
# --project $REPO_NAME \
# --region $REGION
# --quiet
- name: Deploy to cloud run
uses: 'google-github-actions/deploy-cloudrun@v2'
with:
service: $SERVICE_NAME
image: $CONTAINER_NAME:latest
- name: 'Use output'
run: 'curl "${{ steps.deploy.outputs.url }}"'