Skip to content

Commit

Permalink
build.yml: reduce Go binary size
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmouchet committed Jul 5, 2021
1 parent 8be91ec commit 1475d8b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: '^1.16'
- run: |
go build -o node-linux-$GOARCH
# https://stackoverflow.com/questions/3861634/how-to-reduce-compiled-file-size
- name: Build
run: |
go build -ldflags="-s -w" -o node-linux-$GOARCH
upx node-linux-$GOARCH
sha256sum node-linux-$GOARCH > node-linux-$GOARCH.sha256
env:
GOARCH: ${{ matrix.arch }}
- if: github.event_name == 'release'
- name: Upload
if: github.event_name == 'release'
run: gh release upload --clobber $TAG_NAME node-linux-$GOARCH node-linux-$GOARCH.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 1475d8b

Please sign in to comment.