-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (38 loc) · 1.21 KB
/
cd.yml
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
name: deploy code review bot
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: build code review bot
uses: actions/setup-node@v1
with:
node-version: 21.x
- run: |
npm ci
npm run build
- name: docker build
run: docker build -t ${{secrets.DOCKER_USERNAME}}/code_review_bot .
- name: docker login
uses: docker/login-action@v1
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: docker push
run: docker push ${{secrets.DOCKER_USERNAME}}/code_review_bot
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
docker pull ${{ secrets.DOCKER_USERNAME }}/code_review_bot
docker stop code_review_bot
docker rm -f code_review_bot
docker run --name code_review_bot -d -p 3000:3000 --env-file .env -v ./key:/usr/src/app/key ${{ secrets.DOCKER_USERNAME }}/code_review_bot
docker image prune -f