-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (70 loc) · 1.98 KB
/
deploy-to-cm-server.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
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
# This workflow performs continuous delivery (CD) to CM servers.
# This workflow will build the agent and server binaries. Then deploy to CM servers.
name: Deploy to CM Server
on:
push:
branches:
- main
paths-ignore:
- "**.md"
- ".gitignore"
- "LICENSE"
- "CODEOWNERS"
- "docs/**"
- "scripts/**"
# - "assets/**"
# - "scripts/**"
# - "src/testclient/scripts/**"
# - ".all-contributorsrc"
pull_request:
branches:
- main
paths-ignore:
- "**.md"
- ".gitignore"
- "LICENSE"
- "CODEOWNERS"
- "docs/**"
- "scripts/**"
# - "assets/**"
# - "scripts/**"
# - "src/testclient/scripts/**"
# - ".all-contributorsrc"
jobs:
build-and-deploy:
name: Build and deploy
strategy:
matrix:
go-version: ["1.23.0"]
os: [ubuntu-22.04]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go-version}}
- name: Build
run: make
- name: Copy binary to NFS server
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.CM_SERVER_IP_NFS }}
username: ${{ secrets.CM_SERVER_SSH_USER }}
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }}
port: ${{ secrets.CM_SERVER_SSH_PORT }}
source: "cmd/cm-cicada/cm-cicada"
target: "/tmp/"
strip_components: 2
overwrite: true
- name: Restart service from NFS server with new binary
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.CM_SERVER_IP_NFS }}
username: ${{ secrets.CM_SERVER_SSH_USER }}
password: ${{ secrets.CM_SERVER_SSH_PASSWORD }}
port: ${{ secrets.CM_SERVER_SSH_PORT }}
script: |
systemctl stop cm-cicada
mv -f /tmp/cm-cicada /usr/bin/cm-cicada
systemctl start cm-cicada