Skip to content

fix: upload file

fix: upload file #98

Workflow file for this run

name: Build
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v3
# 安装 bun
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Get bun store directory
id: bun-cache
run: |
cd frontend
echo bun_cache_dir=$(bun pm cache) >> $GITHUB_OUTPUT
cd ..
- name: Setup bun cache
uses: actions/cache@v3
with:
path: ${{ steps.bun-cache.outputs.bun_cache_dir }}
key: ${{ runner.os }}-bun-store-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-store-
- name: Build frontend
run: |
cd frontend
bun install
bun run build
cd ..
mv frontend/dist/* pkg/server/dist/
# 安装 go
- uses: actions/setup-go@v3
with:
go-version: ">=1.22.0"
check-latest: true
- name: Setup go cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# 编译
- name: Build
run: |
go mod tidy
go env -w GOARCH=amd64
echo "编译 windows 版本"
go env -w GOOS=windows
go build -ldflags="-s -w" -o ./bin/smq.exe
# 使用 upx 压缩可执行文件
- name: Run UPX
uses: crazy-max/ghaction-upx@v1
with:
version: latest
files: |
./bin/*
args: -fq
- name: Move Files
run: |
mv sample/* bin/
mv assets/ bin/
mv README.md bin/
mv CHANGELOG.md bin/
# 上传到 Artifact
- uses: actions/upload-artifact@v4
with:
name: gosmq
path: ./bin/