添加vsc编译的workflow;修订Makefile

This commit is contained in:
e1732a364fed
2000-01-01 00:00:00 +00:00
parent 4082e59489
commit 0c52bbea72
2 changed files with 38 additions and 2 deletions

View File

@@ -8,6 +8,42 @@ on:
required: true
jobs:
xgo:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Build vsc(verysimple client)
uses: crazy-max/ghaction-xgo@v2
with:
xgo_version: latest
go_version: 1.19
dest: build
prefix: vsc
targets: windows/amd64,windows/arm64,linux/amd64,linux/arm64,darwin/amd64,darwin/arm64
v: true
x: false
race: false
ldflags: -s -w -ldflags "-X 'main.Version=${{ github.event.inputs.tagName }}' -buildid="
buildmode: default
trimpath: true
working_dir: cmd/verysimple
tags: "vcs"
- name: create xz archive
shell: bash
run: |
cd cmd/verysimple/ && for i in vsc*; do tar -cJf $i.tar.xz $i -C ../../ examples/; done && touch -mt $(date +%Y01010000) *.tar.xz
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: cmd/verysimple/vsc*.tar.xz
tag: ${{ github.event.inputs.tagName }}
file_glob: true
build:
runs-on: ubuntu-latest

View File

@@ -1,7 +1,7 @@
# 本文件的一些解释请参考 Makefile_release.
# 本文件用于编译客户端版本的verysimple。vsc = verysimple client
# 该版本使用cgo。
# vsc因为开启了cgo是较难交叉编译的建议在目标平台上编译。
# vsc因为开启了cgo是较难交叉编译的建议在目标平台上编译。或者搜索一下 "xgo"
prefix :=vsc
@@ -26,7 +26,7 @@ else
ifeq ($(detected_OS),Windows)
define compile
set CGO_ENABLED=1&& set GOOS=$(2)&& set GOARCH=$(3)&& $(cmd) $(1)$(4)
set CGO_ENABLED=1&& set GOOS=$(2)&& set GOARCH=$(3)&& $(cmd) ${prefix}_$(1)$(4)
endef
else