Skip to content

format🥚: 格式化 #76

format🥚: 格式化

format🥚: 格式化 #76

Workflow file for this run

# 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