Skip to content

Commit 17fac56

Browse files
authored
Drop debug flags from release binaries and compress them (#285)
1 parent a3aafa8 commit 17fac56

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ jobs:
111111

112112
- run: git fetch --force --tags
113113

114+
- name: Install UPX
115+
uses: crazy-max/ghaction-upx@v3
116+
with:
117+
install-only: true
118+
114119
- uses: actions/setup-go@v5
115120
with:
116121
go-version: '>=1.20'

.goreleaser.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
12
# Documentation at https://goreleaser.com
3+
version: 2
4+
25
before:
36
hooks:
47
- go mod tidy
@@ -13,7 +16,7 @@ builds:
1316
- windows
1417
- darwin
1518
ldflags:
16-
- -X main.version={{.Version}}
19+
- -s -w -X main.version={{.Version}}
1720

1821
archives:
1922
- name_template: >-
@@ -44,3 +47,22 @@ nfpms:
4447
- deb
4548
- rpm
4649
- apk
50+
51+
upx:
52+
- # Whether to enable it or not.
53+
#
54+
# Templates: allowed.
55+
enabled: true
56+
57+
# Filter by GOOS.
58+
goos: [ linux, windows ]
59+
60+
# Compress argument.
61+
# Valid options are from '1' (faster) to '9' (better), and 'best'.
62+
compress: '6'
63+
64+
# Whether to try LZMA (slower).
65+
lzma: false
66+
67+
# Whether to try all methods and filters (slow).
68+
brute: false

scripts/fetch_supported_formats.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
cd "${0%/*}/../"
44
mkdir -p internal/file/embedded
55
curl -fsSLo internal/file/embedded/supported_formats.json https://debricked.com/api/1.0/open/files/supported-formats
6-
ls -l internal/file/embedded/

scripts/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ then
55
echo -e "Failed to find git, thus also the version. Version will be set to v0.0.0"
66
fi
77
version=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
8-
ldFlags="-X main.version=${version}"
8+
ldFlags="-s -w -X main.version=${version}"
99
go install -ldflags "${ldFlags}" ./cmd/debricked
1010
go generate -v -x ./cmd/debricked
1111
go build -ldflags "${ldFlags}" ./cmd/debricked

0 commit comments

Comments
 (0)