Developer
Building Releases
Multi-architecture cross-compilation and automated GitHub Actions release pipelines.
Building Releases
In adherence to GO Shortener's zero-compile deployment model, all production binaries are compiled and verified inside GitHub Actions rather than on destination servers.
The Build Pipeline (.github/workflows/release.yml)
When a version tag (e.g., v1.0.0) is pushed to GitHub, the workflow automatically:
- Runs the test suite (
go test -v ./...). - Syncs frontend assets into
backend/internal/embedded/public. - Cross-compiles standalone binaries for
linux/amd64andlinux/arm64. - Computes SHA-256 checksums into
checksums.txt. - Publishes a GitHub Release containing the binaries and helper scripts.
Manual Local Compilation
To manually compile release binaries on your development workstation:
Terminal
# 1. Sync embedded frontend assets
mkdir -p backend/internal/embedded/public
cp -r frontend/public/* backend/internal/embedded/public/
# 2. Build for Linux x86_64 (amd64)
cd backend
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ../dist/go-shortener-linux-amd64 ./cmd/server/main.go
# 3. Build for Linux ARM64 (aarch64)
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o ../dist/go-shortener-linux-arm64 ./cmd/server/main.go
The
-ldflags="-s -w" flag strips debugging information and DWARF symbol tables, reducing the final compiled executable size from ~22 MB down to ~13 MB.Triggering a GitHub Release
Create and push a Git tag to trigger the cloud release workflow:
Terminal
git tag v1.0.0
git push origin v1.0.0
Once the workflow finishes (typically under 2 minutes), prebuilt binaries will be available on the GitHub repository releases tab.