-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (69 loc) · 2.31 KB
/
deploy.yml
File metadata and controls
83 lines (69 loc) · 2.31 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Deploy Algorithm Server
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.x'
- name: restore dependencies
run: dotnet restore
- name: project build
run: dotnet build --configuration Release --no-restore
- name: publishing binaries
run: dotnet publish -c Release -o algorithm-server
- name: install goose migration tool
run: |
curl --output install.sh https://raw.githubusercontent.com/pressly/goose/master/install.sh
sudo GOOSE_INSTALL=/usr sh install.sh
which goose
- name: applying migrations
run: |
#!/bin/bash
chmod +x ./scripts/run_migrations_server.sh
./scripts/run_migrations_server.sh
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
working-directory: .
- name: setup ssh before script
run: |
eval $(ssh-agent -s)
echo "${{ secrets.VM_PEM }}" | tr -d '\r' | ssh-add -
mkdir -p ~/.ssh
chmod 700 ~/.ssh
- name: clean up running binaries from vm
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.VM_HOST }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.VM_PEM }}
port: 22
script: |
sudo pkill WebAPI || echo 'Process WebAPI not running'
sudo rm -r ~/algorithm-server || echo 'algorithm-folder does not exist'
exit
- name: executing remote ssh commands using ssh key
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.VM_HOST }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.VM_PEM }}
port: 22
source: ./algorithm-server/*
target: ~/
- name: running copied artifact inside vm
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.VM_HOST }}
username: ${{ secrets.VM_USERNAME }}
key: ${{ secrets.VM_PEM }}
port: 22
script: |
nohup ~/algorithm-server/WebAPI &>/dev/null &
exit