Skip to content

fix: update code

fix: update code #57

Workflow file for this run

name: Go Release
on:
push:
# 触发条件:当推送到 master 分支或创建新标签时运行
# branches:
# - master
tags:
- 'v*'
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install MinGW-w64
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x # 使用所需的 Go 版本
cache: true
- name: Install Bee tool
run: | # 安装 Bee 工具
go install github.com/beego/bee/v2@latest
# - name: Build for multiple platforms
# env:
# GOOS: linux darwin windows # 指定目标操作系统
# GOARCH: amd64 arm64 # 指定目标架构
# run: |
# for os in $GOOS; do
# for arch in $GOARCH; do
# output_name="myapp_${os}_${arch}"
# echo "Building for $os/$arch..."
# GOOS=$os GOARCH=$arch bee pack -o $output_name -be GOOS=$os GOARCH=$arch
# done
# done
- name: Build and package for Linux
run: |
export GOOS=linux
export GOARCH=amd64
bee pack -a linux_amd64_feature -be GOOS=$GOOS GOARCH=$GOARCH
- name: Build and package for Windows
run: |
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
export CGO_ENABLED=1
export GOOS=windows
export GOARCH=amd64
bee pack -a windows_amd64_feature -be GOOS=$GOOS GOARCH=$GOARCH
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: false
prerelease: false
files: |
linux_amd64_feature.tar.gz
windows_amd64_feature.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_PERSONAL_ACCESS_TOKEN }}