添加 release.sh 脚本

This commit is contained in:
bjdgyc 2024-01-29 15:11:10 +08:00
parent 769c304e9a
commit 4f77fd9013
2 changed files with 6 additions and 5 deletions

View File

@ -15,6 +15,7 @@ jobs:
steps:
- name: Hello world
run: |
cd server && go mod tidy
uname -a
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
@ -24,7 +25,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '18'
cache: 'yarn'
cache-dependency-path: 'web/yarn.lock'
@ -34,7 +35,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: build
- name: Docker Build
run: |
mkdir server/ui
touch server/ui/index.html

View File

@ -32,19 +32,19 @@ echo "编译二进制文件"
cd $cpath/server
# -tags osusergo,netgo,sqlite_omit_load_extension
flags="-v -trimpath"
flags="-trimpath"
ldflags="-s -w -extldflags '-static' -X main.appVer=$ver -X main.commitId=$(git rev-parse HEAD) -X main.date=$(date --iso-8601=seconds)"
#github action
gopath=$(go env GOPATH)
go mod tidy
#go mod tidy
#使用 musl-dev 编译
docker run -q --rm -v $PWD:/app -v $gopath:/go -w /app --platform=linux/amd64 \
golang:1.20-alpine3.19 go build -o anylink_amd64 $flags -ldflags "$ldflags"
#arm64交叉编译
docker run -q --rm -v $PWD:/app -v $gopath:/go -w /app --platform=linux/arm64 \
golang:1.20-alpine3.19 go build -o anylink_amd64 $flags -ldflags "$ldflags"
golang:1.20-alpine3.19 go build -o anylink_arm64 $flags -ldflags "$ldflags"
./anylink_amd64 -v
./anylink_arm64 -v