From bd95b11eca2d9713cc9feb556ee0678f462ee55b Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 24 Jan 2022 01:57:44 +0800 Subject: [PATCH] =?UTF-8?q?CD:=20build=20=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 5 ++--- Makefile | 23 +++++++++++++++++++++++ spec.sh | 1 + 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1cb912b..8bd35b67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ on: branches: [main] jobs: - unit-test: + release: runs-on: ubuntu-latest strategy: matrix: @@ -74,5 +74,4 @@ jobs: - name: Make Artifact run: | - ls -l . - ls -l ../ + make artifacts diff --git a/Makefile b/Makefile index 3c43c914..b04bdc76 100644 --- a/Makefile +++ b/Makefile @@ -248,6 +248,29 @@ linux: clean mv .tmp/xiang-*-* dist/release/ chmod +x dist/release/xiang-*-* +.PHONY: artifacts +artifacts: clean + mkdir -p dist/release + +# UI制品 + sed -ie "s/url('\/icon/url('\/xiang\/icon/g" .tmp/ui/public/icon/md_icon.css + cd ../ui && npm install && npm run build + +# 静态文件打包 + mkdir -p .tmp/data + cp -r ../ui .tmp/data/ + cp -r xiang .tmp/data/ + go-bindata -fs -pkg data -o data/bindata.go -prefix ".tmp/data/" .tmp/data/... + rm -rf .tmp/data + rm -rf .tmp/ui + +# 制品 + mkdir -p dist + CGO_ENABLED=1 CGO_LDFLAGS="-static" GOOS=linux GOARCH=amd64 go build -v -o dist/yao-${VERSION}-linux-amd64 + mkdir -p dist/release + mv dist/yao-*-* dist/release/ + chmod +x dist/release/xiang-*-* + .PHONY: win32 win32: bindata GOOS=windows GOARCH=386 go build -v -o .tmp/xiang-windows-386 diff --git a/spec.sh b/spec.sh index fdf39ed9..ee8b8800 100755 --- a/spec.sh +++ b/spec.sh @@ -12,6 +12,7 @@ VERSION=$(go run . version) rm -rf ../xiang-spec/xiang/* cp dist/release/xiang-* ~/Code/bin/ rm -f ~/Code/bin/xiang +rm -f ~/Code/bin/yao ln -s ~/Code/bin/xiang-$VERSION-darwin-amd64 ~/Code/bin/xiang ln -s ~/Code/bin/xiang-$VERSION-darwin-amd64 ~/Code/bin/yao