Skip to content

Commit

Permalink
添加 release.sh 脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdgyc committed Jan 29, 2024
1 parent 769c304 commit 4f77fd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4f77fd9

Please sign in to comment.