-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (44 loc) · 1.48 KB
/
deploy.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
name: CI/CD for sibylla
on:
push:
branches:
- master
jobs:
ci_cd:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.23"
- name: Install dependencies
run: go mod download
working-directory: sibylla_service
- name: Run tests
run: go test ./...
working-directory: sibylla_service
- name: Build binary
run: GOOS=linux GOARCH=amd64 go build -o sibylla ./cmd/sibylla_service
working-directory: sibylla_service
- name: List files before copy
run: ls -R
working-directory: sibylla_service
- name: Copy static files
run: mkdir -p static_copy && cp -r static/* static_copy/
working-directory: sibylla_service
- name: List files after copy
run: ls -R static_copy
working-directory: sibylla_service
- name: Add private key
run: |
mkdir -p ~/.ssh
printf "%s" "${{ secrets.DO_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Copy files to server
run: |
scp -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no -r sibylla_service/* root@${{ secrets.DO_DROPLET_IP }}:/root/
- name: Restart service on Droplet
run: |
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no root@${{ secrets.DO_DROPLET_IP }} "sudo systemctl restart sibylla"