forked from gtech-mulearn/mulearnbackend
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 918 Bytes
/
Copy pathdev-deploy-dispatch.yml
File metadata and controls
38 lines (32 loc) · 918 Bytes
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
name: Dev Server Roll
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to deploy"
required: true
default: "dev-server"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure SSH key
uses: webfactory/ssh-agent@v0.4.1
with:
ssh-private-key: ${{ secrets.DEV_SSH_PRIVATE_KEY }}
- name: Deploy
env:
REMOTE_IP: ${{ secrets.DEV_REMOTE_IP }}
PROJECT_PATH: ${{ secrets.PROJECT_PATH }}
BRANCH_NAME: ${{ github.event.inputs.branch }}
run: |
ssh -o StrictHostKeyChecking=no ubuntu@$REMOTE_IP "
cd $PROJECT_PATH &&
git fetch origin &&
git checkout $BRANCH_NAME &&
git reset --hard origin/$BRANCH_NAME &&
docker-compose down &&
docker-compose up --build -d
"