Skip to content

Commit 7701f17

Browse files
committed
add worflow
1 parent 0af1eda commit 7701f17

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/main.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: ASP.NET Core CI
2+
3+
on:
4+
push:
5+
- master
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v1
13+
- name: Setup .NET Core
14+
uses: actions/setup-dotnet@v1
15+
with:
16+
dotnet-version: 3.0.100-preview9-014004
17+
- name: Build with dotnet
18+
run: |
19+
cd src
20+
dotnet build --configuration Release
21+
- name: Publish MatBlazor.Demo.ServerApp
22+
run: |
23+
cd src
24+
dotnet publish MatBlazor.Demo.ServerApp -o ./publish/MatBlazor.Demo.ServerApp
25+
- name: Deploy MatBlazor.Demo.ServerApp
26+
env:
27+
PRIVATE_KEY: ${{ secrets.ssh_key }}
28+
HOST: srv4.samprof.com
29+
USER: root
30+
run: |
31+
cd src
32+
set -e
33+
34+
SSH_PATH="$HOME/.ssh"
35+
36+
mkdir -p "$SSH_PATH"
37+
touch "$SSH_PATH/known_hosts"
38+
39+
echo "$PRIVATE_KEY" > "$SSH_PATH/deploy_key"
40+
41+
chmod 700 "$SSH_PATH"
42+
chmod 600 "$SSH_PATH/known_hosts"
43+
chmod 600 "$SSH_PATH/deploy_key"
44+
45+
eval $(ssh-agent)
46+
ssh-add "$SSH_PATH/deploy_key"
47+
48+
ssh-keyscan -t rsa $HOST >> "$SSH_PATH/known_hosts"
49+
50+
ssh -o StrictHostKeyChecking=no -A -tt -p ${PORT:-22} $USER@$HOST "systemctl stop www.matblazor.com.service"
51+
scp -r ./publish/MatBlazor.Demo.ServerApp/* $USER@$HOST:/var/host/www.matblazor.com
52+
ssh -o StrictHostKeyChecking=no -A -tt -p ${PORT:-22} $USER@$HOST "systemctl stop www.matblazor.com.service"
53+
54+
ssh -o StrictHostKeyChecking=no -A -tt -p ${PORT:-22} $USER@$HOST "systemctl start www.matblazor.com.service"
55+

0 commit comments

Comments
 (0)