-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.31 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
47
48
49
name: build-and-deploy
on:
push:
branches:
- main
jobs:
build-image:
name: Build and push docker image
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
bamboooo/himo-outgame:latest
deploy:
needs: build-image
name: Deploy to dev server
runs-on: ubuntu-latest
steps:
- name: Deploy to dev
run: |
echo "$SSH_KEY" > secret_key
chmod 600 secret_key
ssh -o StrictHostKeyChecking=no ${ORACLE_USER}@${ORACLE_HOST} -i secret_key "cd ~/himo-outgame && git pull origin main && docker-compose -f docker-compose-prod.yml stop && docker-compose -f docker-compose-prod.yml pull outgame && docker-compose -f docker-compose-prod.yml up --build -d"
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
ORACLE_USER: ${{ secrets.ORACLE_USER }}
ORACLE_HOST: ${{ secrets.ORACLE_HOST }}