-
Notifications
You must be signed in to change notification settings - Fork 5
54 lines (46 loc) · 1.4 KB
/
dev-deploy.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
on:
push:
branches:
- dev
paths:
- 'server/**'
workflow_dispatch:
defaults:
run:
working-directory: server
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build -t jmensch1/codeflower:${{github.sha}} --build-arg GITHUB_SHA=${{ github.sha }} .
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: jmensch1
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image
run: docker push jmensch1/codeflower:${{github.sha}}
deploy:
runs-on: ubuntu-latest
needs: build-and-push
steps:
- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DEV_HOST }}
username: ${{ secrets.DEV_USERNAME }}
key: ${{ secrets.DEV_PRIVATE_KEY }}
script: |
docker pull jmensch1/codeflower:${{github.sha}}
docker stop codeflower
docker rm codeflower
docker run -d \
--restart always \
-p 80:8000 \
--name codeflower \
-e MIXPANEL_TOKEN=${{ secrets.DEV_MIXPANEL_TOKEN }} \
-e SENTRY_DSN=${{ secrets.DEV_SENTRY_DSN }} \
jmensch1/codeflower:${{github.sha}}
docker system prune -af