Skip to content

Commit ee6a326

Browse files
committed
Drop debug flags from release binaries and compress them
1 parent a3aafa8 commit ee6a326

File tree

4 files changed

+113
-87
lines changed

4 files changed

+113
-87
lines changed

.github/workflows/release.yml

Lines changed: 89 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Release
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
5+
# tags:
6+
# - 'v*'
77

88
permissions:
99
contents: write
@@ -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'
@@ -137,85 +142,85 @@ jobs:
137142
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138143
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
139144

140-
- name: Download JAR archives
141-
uses: actions/download-artifact@v4
142-
143-
- name: Add archives with JARs to release
144-
uses: softprops/action-gh-release@v2
145-
if: startsWith(github.ref, 'refs/tags/')
146-
with:
147-
tag_name: ${{ github.ref_name }}
148-
files: |
149-
soot-wrapper-rev-hash.txt/soot-wrapper-rev-hash.txt
150-
soot-wrapper-11.zip/soot-wrapper-11.zip
151-
soot-wrapper-17.zip/soot-wrapper-17.zip
152-
soot-wrapper-21.zip/soot-wrapper-21.zip
153-
154-
major-release:
155-
runs-on: ubuntu-latest
156-
needs: goreleaser
157-
steps:
158-
- uses: actions/checkout@v4
159-
with:
160-
fetch-depth: 0
161-
- name: Update major release tag
162-
id: major-tag
163-
run: |
164-
# returns v1, v2, etc, everything to the left of the leftmost dot.
165-
MAJOR_VERSION="${GITHUB_REF_NAME%%.*}"
166-
MAJOR_TAG="release-${MAJOR_VERSION}"
167-
echo "MAJOR_VERSION=${MAJOR_VERSION}" >> "$GITHUB_OUTPUT"
168-
echo "MAJOR_TAG=${MAJOR_TAG}" >> "$GITHUB_OUTPUT"
169-
git tag -f "${MAJOR_TAG}"
170-
git push -f origin "${MAJOR_TAG}"
171-
- name: Fetch assets from actual release
172-
env:
173-
MAJOR_TAG: ${{ steps.major-tag.outputs.MAJOR_TAG }}
174-
GH_TOKEN: ${{ github.token }}
175-
run: |
176-
gh release download --pattern="cli_*.tar.gz" "${GITHUB_REF_NAME}"
177-
- name: Create or update release
178-
uses: softprops/action-gh-release@v2
179-
with:
180-
body: Latest release for the ${{ steps.major-tag.outputs.MAJOR_VERSION }} branch of the CLI
181-
name: Latest ${{ steps.major-tag.outputs.MAJOR_VERSION }} CLI
182-
tag_name: ${{ steps.major-tag.outputs.MAJOR_TAG }}
183-
fail_on_unmatched_files: true
184-
make_latest: false
185-
files: "cli_*.tar.gz"
186-
187-
188-
aur:
189-
runs-on: ubuntu-latest
190-
needs: goreleaser
191-
container:
192-
image: archlinux/archlinux:base-devel
193-
steps:
194-
- name: Prepare Arch Linux container
195-
run: |
196-
pacman -Syu --noconfirm git go openssh pacman-contrib
197-
useradd -m aur
198-
199-
# Setup SSH access to aur.archlinux.org
200-
- uses: webfactory/[email protected]
201-
with:
202-
ssh-private-key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
203-
204-
# Now actually clone AUR repo, and update to new version
205-
- name: Build package and update AUR
206-
run: |
207-
export NEW_VERSION="${GITHUB_REF_NAME#v}"
208-
sudo -u aur sh -c "mkdir -p /home/aur/.ssh && chmod 700 /home/aur/.ssh && touch /home/aur/.ssh/known_hosts && chmod 600 /home/aur/.ssh/known_hosts"
209-
sudo -u aur sh -c "echo 'aur.archlinux.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuBKrPzbawxA/k2g6NcyV5jmqwJ2s+zpgZGZ7tpLIcN' >> /home/aur/.ssh/known_hosts"
210-
mkdir -p /root/.ssh && chmod 700 /root/.ssh && cp /home/aur/.ssh/known_hosts /root/.ssh/known_hosts && chown root: /root/.ssh/known_hosts
211-
# clone repo
212-
git clone [email protected]:debricked.git debricked
213-
chown -R aur debricked/
214-
cd debricked/
215-
sudo -u aur NEW_VERSION="${NEW_VERSION}" make update_version
216-
sudo -u aur make package
217-
sudo -u aur git diff
218-
sudo -u aur git config user.email [email protected]
219-
sudo -u aur git config user.name "Debricked build bot"
220-
git config --global --add safe.directory "$PWD"
221-
make push
145+
# - name: Download JAR archives
146+
# uses: actions/download-artifact@v4
147+
#
148+
# - name: Add archives with JARs to release
149+
# uses: softprops/action-gh-release@v2
150+
# if: startsWith(github.ref, 'refs/tags/')
151+
# with:
152+
# tag_name: ${{ github.ref_name }}
153+
# files: |
154+
# soot-wrapper-rev-hash.txt/soot-wrapper-rev-hash.txt
155+
# soot-wrapper-11.zip/soot-wrapper-11.zip
156+
# soot-wrapper-17.zip/soot-wrapper-17.zip
157+
# soot-wrapper-21.zip/soot-wrapper-21.zip
158+
#
159+
# major-release:
160+
# runs-on: ubuntu-latest
161+
# needs: goreleaser
162+
# steps:
163+
# - uses: actions/checkout@v4
164+
# with:
165+
# fetch-depth: 0
166+
# - name: Update major release tag
167+
# id: major-tag
168+
# run: |
169+
# # returns v1, v2, etc, everything to the left of the leftmost dot.
170+
# MAJOR_VERSION="${GITHUB_REF_NAME%%.*}"
171+
# MAJOR_TAG="release-${MAJOR_VERSION}"
172+
# echo "MAJOR_VERSION=${MAJOR_VERSION}" >> "$GITHUB_OUTPUT"
173+
# echo "MAJOR_TAG=${MAJOR_TAG}" >> "$GITHUB_OUTPUT"
174+
# git tag -f "${MAJOR_TAG}"
175+
# git push -f origin "${MAJOR_TAG}"
176+
# - name: Fetch assets from actual release
177+
# env:
178+
# MAJOR_TAG: ${{ steps.major-tag.outputs.MAJOR_TAG }}
179+
# GH_TOKEN: ${{ github.token }}
180+
# run: |
181+
# gh release download --pattern="cli_*.tar.gz" "${GITHUB_REF_NAME}"
182+
# - name: Create or update release
183+
# uses: softprops/action-gh-release@v2
184+
# with:
185+
# body: Latest release for the ${{ steps.major-tag.outputs.MAJOR_VERSION }} branch of the CLI
186+
# name: Latest ${{ steps.major-tag.outputs.MAJOR_VERSION }} CLI
187+
# tag_name: ${{ steps.major-tag.outputs.MAJOR_TAG }}
188+
# fail_on_unmatched_files: true
189+
# make_latest: false
190+
# files: "cli_*.tar.gz"
191+
#
192+
#
193+
# aur:
194+
# runs-on: ubuntu-latest
195+
# needs: goreleaser
196+
# container:
197+
# image: archlinux/archlinux:base-devel
198+
# steps:
199+
# - name: Prepare Arch Linux container
200+
# run: |
201+
# pacman -Syu --noconfirm git go openssh pacman-contrib
202+
# useradd -m aur
203+
#
204+
# # Setup SSH access to aur.archlinux.org
205+
# - uses: webfactory/[email protected]
206+
# with:
207+
# ssh-private-key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
208+
#
209+
# # Now actually clone AUR repo, and update to new version
210+
# - name: Build package and update AUR
211+
# run: |
212+
# export NEW_VERSION="${GITHUB_REF_NAME#v}"
213+
# sudo -u aur sh -c "mkdir -p /home/aur/.ssh && chmod 700 /home/aur/.ssh && touch /home/aur/.ssh/known_hosts && chmod 600 /home/aur/.ssh/known_hosts"
214+
# sudo -u aur sh -c "echo 'aur.archlinux.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuBKrPzbawxA/k2g6NcyV5jmqwJ2s+zpgZGZ7tpLIcN' >> /home/aur/.ssh/known_hosts"
215+
# mkdir -p /root/.ssh && chmod 700 /root/.ssh && cp /home/aur/.ssh/known_hosts /root/.ssh/known_hosts && chown root: /root/.ssh/known_hosts
216+
# # clone repo
217+
# git clone [email protected]:debricked.git debricked
218+
# chown -R aur debricked/
219+
# cd debricked/
220+
# sudo -u aur NEW_VERSION="${NEW_VERSION}" make update_version
221+
# sudo -u aur make package
222+
# sudo -u aur git diff
223+
# sudo -u aur git config user.email [email protected]
224+
# sudo -u aur git config user.name "Debricked build bot"
225+
# git config --global --add safe.directory "$PWD"
226+
# make push

.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)