.gitignore 🔗
@@ -5,4 +5,5 @@
.crush
.chunkhound
lune
+dist/
.task
Amolith created
Add Taskfile tasks for cross-compiled release builds:
- release:build: compiles for linux/{amd64,arm64}, darwin/{amd64,arm64},
windows/amd64, and freebsd/amd64 into dist/
- release:pack: UPX-compresses Linux binaries (~65% size reduction);
other targets lack 64-bit UPX support
- release:upload: hands off dist/* to the release fish function
- release:all: chains tag → build → pack → upload
Also adds dist/ to .gitignore and clean task.
.gitignore | 1
Taskfile.yaml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletion(-)
@@ -5,4 +5,5 @@
.crush
.chunkhound
lune
+dist/
.task
@@ -83,13 +83,66 @@ tasks:
clean:
desc: Remove build artifacts
cmds:
- - rm -rf lune
+ - rm -rf lune dist/
clean-all:
desc: Remove build artifacts and config.toml
cmds:
- rm -rf lune config.toml
+ release:build:
+ desc: Cross-compile for all release targets
+ vars:
+ TARGETS: >-
+ linux/amd64
+ linux/arm64
+ darwin/amd64
+ darwin/arm64
+ windows/amd64
+ freebsd/amd64
+ cmds:
+ - rm -rf dist
+ - mkdir -p dist
+ - for: {var: TARGETS, split: " "}
+ cmd: |
+ os=$(echo {{.ITEM}} | cut -d/ -f1)
+ arch=$(echo {{.ITEM}} | cut -d/ -f2)
+ ext=""; if [ "$os" = "windows" ]; then ext=".exe"; fi
+ echo "Building ${os}/${arch}..."
+ GOOS=${os} GOARCH=${arch} go build \
+ -o "dist/lune-{{.VERSION}}-${os}-${arch}${ext}" \
+ -ldflags "-s -w -X main.version={{.VERSION}}"
+
+ release:pack:
+ desc: Compress release binaries with UPX where supported
+ vars:
+ # UPX 5.x dropped macOS support; windows/amd64 is PE32 only and
+ # freebsd/amd64 is ELF32 only, so only Linux targets are packed.
+ PACK_TARGETS: >-
+ linux-amd64
+ linux-arm64
+ cmds:
+ - for: {var: PACK_TARGETS, split: " "}
+ cmd: |
+ bin="dist/lune-{{.VERSION}}-{{.ITEM}}"
+ if [ -f "$bin" ]; then
+ echo "Packing {{.ITEM}}..."
+ upx -q "$bin"
+ fi
+
+ release:upload:
+ desc: Upload release artifacts
+ cmds:
+ - fish -c 'release upload lune {{.VERSION}} --latest dist/*'
+
+ release:all:
+ desc: Tag, build, pack, and upload a release
+ cmds:
+ - task release
+ - task release:build
+ - task release:pack
+ - task release:upload
+
release:
desc: Interactive release workflow
vars: