Skip to content

Commit

Permalink
Create cd-staging.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Chengming-Li authored Apr 17, 2024
1 parent d980e7e commit bb46147
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/cd-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name:
Deploy to Staging

on:
push:
branches: [ master ]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Backend Image
run: docker build -t berkeleytime-backend ./backend/
- name: Tag Backend Image
run: docker tag berkeleytime-backend ${{ secrets.DOCKER_USERNAME }}/berkeleytime-backend:staging
- name: Push Backend Image
run: docker push ${{ secrets.DOCKER_USERNAME }}/berkeleytime-backend:staging
- name: Build Frontend Image
run: docker build -t berkeleytime-frontend ./frontend/
- name: Tag Frontend Image
run: docker tag berkeleytime-frontend ${{ secrets.DOCKER_USERNAME }}/berkeleytime-frontend:staging
- name: Push Frontend Image
run: docker push ${{ secrets.DOCKER_USERNAME }}/berkeleytime-frontend:staging
- name: executing remote ssh commands using ssh key
uses: appleboy/[email protected]
with:
host: hozer-51.ocf.berkeley.edu
username: root
key: ${{ secrets.SSH_KEY }}
port: 22
script: |
kubectl rollout restart deployment bt-staging-app-backend
kubectl rollout restart deployment bt-staging-app-frontend

0 comments on commit bb46147

Please sign in to comment.