Skip to content

fix: skip UPX compression for macOS binaries #9

fix: skip UPX compression for macOS binaries

fix: skip UPX compression for macOS binaries #9

Workflow file for this run

name: Build
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
ext=""
if [ "${{ matrix.goos }}" = "windows" ]; then
ext=".exe"
fi
output="dj-${{ matrix.goos }}-${{ matrix.goarch }}${ext}"
TAG="${GITHUB_REF#refs/tags/}"
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${TAG}" -o "${output}" .
- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
version: latest
- name: Compress with UPX
if: matrix.goos != 'darwin'
run: |
ext=""
if [ "${{ matrix.goos }}" = "windows" ]; then
ext=".exe"
fi
output="dj-${{ matrix.goos }}-${{ matrix.goarch }}${ext}"
upx -9 "${output}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dj-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
dj-${{ matrix.goos }}-${{ matrix.goarch }}*
retention-days: 30
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: dj-*
path: artifacts
merge-multiple: true
- name: Display structure
run: ls -la artifacts/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
draft: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}