-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (43 loc) · 1.19 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
name: CI/CD for sibylla
on:
push:
branches:
- master
jobs:
build:
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.17"
- name: Install dependencies
run: go mod download
- name: Run tests
run: go test ./...
- name: Build binary
run: GOOS=linux GOARCH=amd64 go build -o myapp
- name: Copy static files
run: mkdir -p static && cp -r static ./static/
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Copy files to server
uses: appleboy/scp-action@v0.0.4
with:
host: ${{ secrets.DO_DROPLET_IP }}
username: ${{ secrets.DO_SSH_USER }}
key: ${{ secrets.DO_SSH_KEY }}
source: "./myapp ./static/"
target: "/root/"
- name: Restart service on Droplet
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.DO_DROPLET_IP }}
username: ${{ secrets.DO_SSH_USER }}
key: ${{ secrets.DO_SSH_KEY }}
script: |
sudo systemctl restart myapp