ci : updates #9
Workflow file for this run
This file contains 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: 🏓 backend-cd | |
# on: | |
# push: | |
# branches: | |
# - main | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
defaults: | |
run: | |
working-directory: ./backend | |
env: | |
CONTAINER_NAME: arunavabasu03/radisapp_backend | |
REPO_NAME: ${{ secrets.REPO_NAME }} | |
SERVICE_NAME : ${{ secrets.SERVICE_NAME }} | |
REGION: us-central1 | |
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 }} | |
- uses: "google-github-actions/auth@v2" | |
with: | |
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 radisapp_backend \ | |
--image $CONTAINER_NAME:latest \ | |
--platform managed --project $REPO_NAME \ | |
--region $REGION | |