Files
bl/.github/workflows/logic_CI.yml
昔念 2fa59640e0 build: 更新项目结构并移除冗余文件
- 删除了 Go workflow 文件,简化构建流程
- 移除了 docker-compose.yml 文件,减少不必要的容器编排
- 更新了 README.md,精简了项目结构说明
2025-07-05 19:31:53 +08:00

55 lines
1.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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: Go
on:
push:
tags:
- 'v*'
env:
TAG_NAME: ${{ github.ref_name }} # 直接获取简化后的 ref 名称
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 缓存Go依赖
id: go-cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod # Go模块缓存路径
key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- name: 获取tag名称
id: tag_name
run: |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: 编译logic服务
run: go build -o ./public/logic_${{ env.TAG }} -v ./logic
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: logic_${{ env.TAG }}
path: ./public/logic_${{ env.TAG }}
- name: 推送到服务器
uses: easingthemes/ssh-deploy@main # 第三方SSH部署插件
env:
SSH_PRIVATE_KEY: ${{ secrets.BLAZING }} # 从仓库密钥读取私钥
REMOTE_HOST: "82.23.177.97" # 服务器公网IP或域名
REMOTE_USER: "root" # 步骤1创建的用户
SOURCE: "public/" # 本地构建输出目录
TARGET: "/home/" # 服务器目标目录
ARGS: "-avz --chown=git:git" # rsync参数归档模式/压缩/删除多余文件