-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (70 loc) · 2.31 KB
/
relay.groups.nip29.com-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
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
84
85
name: Deploy Golang Groups Relay
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Clean up previous builds
run: rm -rf ./relay.groups.nip29.com
- name: Install ARM64 Toolchain
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23.0' # Use latest Go version
- name: Cache Go Modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build Application
run: CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -buildvcs=false -o relay.groups.nip29.com
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: relay-server
path: relay.groups.nip29.com
deploy:
runs-on: ubuntu-24.04
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: relay-server
- name: Deploy to Server
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: ${{ secrets.SERVER_PORT }}
source: "relay.groups.nip29.com"
target: "/var/www/relays"
- name: Set execute permission
uses: appleboy/ssh-action@v0.1.3
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: chmod +x /var/www/relays/relay.groups.nip29.com
- name: Restart Application
uses: appleboy/ssh-action@v0.1.3
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: sudo systemctl restart relay-groups.service