-
Notifications
You must be signed in to change notification settings - Fork 9
57 lines (49 loc) · 1.97 KB
/
cd-dev.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Deploy to Dev
on:
workflow_dispatch:
inputs:
ttl:
description: "Deployment time to live in seconds"
required: true
type: number
default: 86400
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 ${{ github.sha }})" >> $GITHUB_ENV
- 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:${{ env.sha_short }}" .
docker build --target frontend-dev --tag "${{ secrets.DOCKER_USERNAME }}/bt-frontend:${{ env.sha_short }}" .
- name: Push Images to Docker Hub
run: |
docker push "${{ secrets.DOCKER_USERNAME }}/bt-backend:${{ env.sha_short }}"
docker push "${{ secrets.DOCKER_USERNAME }}/bt-frontend:${{ env.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 uninstall bt-dev-app-${{ env.sha_short }} || true
helm install bt-dev-app-${{ env.sha_short }} ./app --namespace=bt \
--set env=dev \
--set ttl=${{ inputs.ttl }} \
--set frontend.image.tag=${{ env.sha_short }} \
--set backend.image.tag=${{ env.sha_short }} \
--set host=${{ env.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