ci : updates #5
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 | |
REGION: us-east1 | |
REPO_NAME: nextjs-cloud-run | |
jobs: | |
backend-deploy: | |
name: 🚀 Deploy to production | |
runs-on: ubuntu-latest | |
steps: | |
# checkout github repo | |
- 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: Build and push Docker image | |
run: | | |
docker build -t $CONTAINER_NAME:${{ github.sha }} -t $CONTAINER_NAME:latest . | |
docker push $CONTAINER_NAME:${{ github.sha }} | |
docker push $CONTAINER_NAME:latest | |
- name: "Set up Cloud SDK" | |
uses: "google-github-actions/setup-gcloud@v2" | |
- name: Deploy to Cloud Run | |
run: | | |
gcloud run deploy $REPO_NAME \ | |
--region $REGION \ | |
--image $CONTAINER_NAME:latest\ | |
--platform "managed" \ | |
--quiet |