Skip to content

Commit

Permalink
ci: static complie binary
Browse files Browse the repository at this point in the history
  • Loading branch information
chaunsin committed Nov 26, 2024
1 parent 07162e4 commit 5ee3fdf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
run: |
echo "BUILD_TIME=$(date --rfc-3339=seconds --utc)" >> $GITHUB_ENV
echo "PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_ENV
echo "COMMIT_HASH=$(echo "${{ github.sha }}" | cut -c 1-7)" >> $GITHUB_ENV
# Step 2: 设置 Go 环境
- name: Set up Go environment
Expand All @@ -55,6 +56,7 @@ jobs:
run: |
mkdir -p output
xgo --targets=darwin-10.14/*,windows-6.1/*,linux/amd64,linux/arm64,linux/mips64,linux/mips64le,linux/ppc64le,linux/riscv64 \
--ldflags "-linkmode "external" -extldflags "-static" -s -w -X 'main.BuildTime=${{ env.BUILD_TIME }}' -X 'main.Version=${{github.ref_name}}' -X 'main.Commit=${{ env.COMMIT_HASH }}'" \
-out output/ncmctl ./cmd/ncmctl/main.go
echo "Build output:"
tree ./output
Expand Down

0 comments on commit 5ee3fdf

Please sign in to comment.