-
Notifications
You must be signed in to change notification settings - Fork 3
145 lines (131 loc) · 5.04 KB
/
go.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Release Golang
on:
push:
tags:
- 'v*' # 推送标签,比如 v1.0, v20.15.10
# on:
# push:
# paths:
# - "cloud/**"
# pull_request:
# branches: ["tenant"]
# paths:
# - "cloud/**"
env:
TZ: Asia/Shanghai
jobs:
build: # 声明job的名字
runs-on: ubuntu-20.04 # 使用ubuntu系统镜像运行脚本
# steps定义job的步骤,具体执行,运行xxx,-字符开头的一块则为一个步骤,可以配置多个步骤
steps:
- uses: actions/checkout@v4 # 下载git仓库中的代码,使用官方提供,使用库用uses关键字
with:
clean: false
- name: SetUp Go # 下载go代码
uses: actions/setup-go@v5 # 使用官方提供
with:
go-version: 1.22.5 # 指定go版本1.22.1
check-latest: true
- name: Install linux deps
run: |
sudo apt-get -y install libvips-dev
- name: Build Go # 编译仓库中的代码
run: |
cd cloud
./build.sh
- name: Generate Build Artifacts # 打包编译文件
uses: actions/upload-artifact@v4
with:
name: compiled
path: |
cloud/bin/
cloud/config/pro/
stop:
runs-on: ubuntu-20.04
steps:
- name: SSH Remote Commands
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script_stop: true
script: |
supervisorctl stop ApolloHertz
supervisorctl stop ApolloGrpc
needs:
- build
golang:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4 # 下载git仓库中的代码,使用官方提供,使用库用uses关键字
with:
clean: false
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: compiled
path: ./compiled
- name: FTP Golang
uses: sand4rt/ftp-deployer@v1.8
with:
sftp: false # optional
host: ${{ secrets.HOST }} # e.g. ftp.host.com or sftp.host.com (without ftp:// or ftps://)
port: 21 # optional, default is: 21
username: ${{ secrets.FTP_USERNAME }} # FTP username
password: ${{ secrets.FTP_PASSWORD }} # FTP password
remote_folder: apollo/cloud/ # optional, remote path of your FTP server
local_folder: ./compiled # optional, local path, default is: dist
cleanup: false # optional, remove existing files inside FTP remote folder
# include: '[]' # optional, e.g. '['dist']'
# exclude: '[]' # optional, e.g. '['node_modules/**', '.git/**', '*.env']'
passive: true # optional
# - name: FTP bin
# uses: sand4rt/ftp-deployer@v1.8
# with:
# sftp: false # optional
# host: ${{ secrets.HOST }} # e.g. ftp.host.com or sftp.host.com (without ftp:// or ftps://)
# port: 21 # optional, default is: 21
# username: ${{ secrets.FTP_USERNAME }} # FTP username
# password: ${{ secrets.FTP_PASSWORD }} # FTP password
# remote_folder: apollo/cloud/bin # optional, remote path of your FTP server
# local_folder: cloud/bin # optional, local path, default is: dist
# cleanup: false # optional, remove existing files inside FTP remote folder
# # include: '[]' # optional, e.g. '['dist']'
# # exclude: '[]' # optional, e.g. '['node_modules/**', '.git/**', '*.env']'
# passive: true # optional
# - name: FTP config
# uses: sand4rt/ftp-deployer@v1.8
# with:
# sftp: false # optional
# host: ${{ secrets.HOST }} # e.g. ftp.host.com or sftp.host.com (without ftp:// or ftps://)
# port: 21 # optional, default is: 21
# username: ${{ secrets.FTP_USERNAME }} # FTP username
# password: ${{ secrets.FTP_PASSWORD }} # FTP password
# remote_folder: apollo/cloud/config/pro # optional, remote path of your FTP server
# local_folder: cloud/config/pro # optional, local path, default is: dist
# cleanup: false # optional, remove existing files inside FTP remote folder
# # include: '[]' # optional, e.g. '['dist']'
# # exclude: '[]' # optional, e.g. '['node_modules/**', '.git/**', '*.env']'
# passive: true # optional
needs:
- stop
start:
runs-on: ubuntu-20.04
steps:
- name: SSH Remote Commands
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script_stop: true
script: |
supervisorctl start ApolloGrpc
supervisorctl start ApolloHertz
needs:
- golang