Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop debug flags from release binaries and compress them #285

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ jobs:

- run: git fetch --force --tags

- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true

- uses: actions/setup-go@v5
with:
go-version: '>=1.20'
Expand Down
24 changes: 23 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# Documentation at https://goreleaser.com
version: 2

before:
hooks:
- go mod tidy
Expand All @@ -13,7 +16,7 @@ builds:
- windows
- darwin
ldflags:
- -X main.version={{.Version}}
- -s -w -X main.version={{.Version}}

archives:
- name_template: >-
Expand Down Expand Up @@ -44,3 +47,22 @@ nfpms:
- deb
- rpm
- apk

upx:
- # Whether to enable it or not.
#
# Templates: allowed.
enabled: true

# Filter by GOOS.
goos: [ linux, windows ]

# Compress argument.
# Valid options are from '1' (faster) to '9' (better), and 'best'.
compress: '6'

# Whether to try LZMA (slower).
lzma: false

# Whether to try all methods and filters (slow).
brute: false
1 change: 0 additions & 1 deletion scripts/fetch_supported_formats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
cd "${0%/*}/../"
mkdir -p internal/file/embedded
curl -fsSLo internal/file/embedded/supported_formats.json https://debricked.com/api/1.0/open/files/supported-formats
ls -l internal/file/embedded/
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ then
echo -e "Failed to find git, thus also the version. Version will be set to v0.0.0"
fi
version=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
ldFlags="-X main.version=${version}"
ldFlags="-s -w -X main.version=${version}"
go install -ldflags "${ldFlags}" ./cmd/debricked
go generate -v -x ./cmd/debricked
go build -ldflags "${ldFlags}" ./cmd/debricked
Loading