Skip to content

Deploy to Dev

Deploy to Dev #4

Workflow file for this run

name: Deploy to Dev
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set vars
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Images with Tags
run: |
docker build --target backend-dev --tag "${{ secrets.DOCKER_USERNAME }}/bt-backend:${{ steps.vars.output.sha_short }}" .
docker build --target frontend-dev --tag "${{ secrets.DOCKER_USERNAME }}/bt-frontend:${{ steps.vars.output.sha_short }}" .
- name: Push Images to Docker Hub
run: |
docker push "${{ secrets.DOCKER_USERNAME }}/bt-backend:${{ steps.vars.output.sha_short }}"
docker push "${{ secrets.DOCKER_USERNAME }}/bt-frontend:${{ steps.vars.output.sha_short }}"
- name: SSH and Helm Install
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: root
key: ${{ secrets.SSH_KEY }}
script: |
cd ./infra
helm install bt-dev-app-${{ steps.vars.output.sha_short }} ./app --namespace=bt \
--set host=${{ steps.vars.output.sha_short }}.stanfurdtime.com \
--set mongoUri=mongodb://bt-dev-mongo-mongodb.bt.svc.cluster.local:27017/bt \
--set redisUri=redis://bt-dev-redis-master.bt.svc.cluster.local:6379 \
--set nodeEnv=development