diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c7b2383 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,94 @@ +name: release-homecli + +on: + workflow_dispatch: + inputs: + version: + description: "Release version (e.g., 0.4.25)" + required: true + type: string + branch: + description: "Release branch" + required: true + type: choice + default: release/v0.4 + options: + - release/v0.4 + +jobs: + release: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write # to create tags and github releases + + steps: + # weka/gohomecli is DEPRECATED. Releases of the Weka Home CLI are cut from + # https://github.com/weka/gohome. This guard fails any dispatch of this + # workflow from master; the release/v0.4 ref is deliberately left + # unguarded so an emergency hotfix can still be shipped from there. + - name: Repository is deprecated + run: | + echo "::error::weka/gohomecli is DEPRECATED - release from https://github.com/weka/gohome instead" + { + echo "## :warning: weka/gohomecli is deprecated" + echo "" + echo "The Weka Home CLI has moved to [weka/gohome](https://github.com/weka/gohome)." + echo "Cut this release from there instead:" + echo "" + echo '```' + echo 'git clone git@github.com:weka/gohome.git' + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + exit 1 + + - name: Validate version format + env: + VERSION: ${{ github.event.inputs.version }} + run: | + if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Version must be in format X.Y.Z (e.g., 0.4.25)" + exit 1 + fi + + - name: Checkout release branch + uses: actions/checkout@v4.1.1 + with: + ref: ${{ github.event.inputs.branch }} + fetch-depth: 0 + + - name: Check if tag already exists + env: + VERSION: ${{ github.event.inputs.version }} + run: | + if git rev-parse "v$VERSION" >/dev/null 2>&1; then + echo "::error::Tag v$VERSION already exists. Please use a different version." + exit 1 + fi + echo "Tag v$VERSION does not exist, proceeding with release." + + - name: Setup Golang + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache-dependency-path: go.sum + + - name: Build binaries + env: + VERSION: ${{ github.event.inputs.version }} + run: | + chmod +x ./build.sh + ./build.sh "$VERSION" + + - name: Create GitHub Release + uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981 + with: + tag_name: "v${{ github.event.inputs.version }}" + name: "v${{ github.event.inputs.version }}" + target_commitish: ${{ github.event.inputs.branch }} + draft: false + generate_release_notes: true + files: | + bin/homecli_linux_amd64 + bin/homecli_darwin_amd64 diff --git a/Makefile b/Makefile index 9b7a72a..5e0ac3a 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,25 @@ +# ============================================================================ +# weka/gohomecli is DEPRECATED. This Makefile intentionally refuses to run. +# +# The error function below fires during Make's read phase, so *every* target - +# build, test, clean, all - stops here. Do not remove this guard; move to the +# new repository instead. +# ============================================================================ +$(info ) +$(info ============================================================================) +$(info weka/gohomecli is DEPRECATED - it no longer builds.) +$(info ) +$(info The Weka Home CLI has moved to: https://github.com/weka/gohome) +$(info ) +$(info You are building from a stale clone. Get the new repository:) +$(info ) +$(info $$ git clone git@github.com:weka/gohome.git) +$(info ) +$(info If you have local work here, re-apply it against weka/gohome.) +$(info ============================================================================) +$(info ) +$(error refusing to build a deprecated repository) + BUILD_PATH=$(CURDIR) BIN_PATH=$(BUILD_PATH)/bin PKG_PATH=$(BUILD_PATH)/pkg diff --git a/README.md b/README.md index 388d44a..2a1e5c0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ +> [!CAUTION] +> **This repository is deprecated and no longer builds.** +> +> The Weka Home CLI has moved to **[weka/gohome](https://github.com/weka/gohome)**. +> Every build entry point here (`make`, `./build.sh`, `./deploy.sh`, `go build`, +> the release workflow) fails on purpose so stale clones stop shipping from here. +> +> ``` +> git clone git@github.com:weka/gohome.git +> ``` +> +> If you have local work in this clone, re-apply it against `weka/gohome`. +> The documentation below is kept for historical reference only. + # Weka Home Command Line Utility diff --git a/build.sh b/build.sh index ce878c0..f86a4f2 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,92 @@ #!/usr/bin/env sh +# ============================================================================ +# weka/gohomecli is DEPRECATED. This script intentionally refuses to run. +# Do not remove this guard; move your work to weka/gohome instead. +# ============================================================================ +cat >&2 <<'DEPRECATED' + +============================================================================ + weka/gohomecli is DEPRECATED - it no longer builds. + + The Weka Home CLI has moved to: https://github.com/weka/gohome + + You are building from a stale clone. Get the new repository: + + $ git clone git@github.com:weka/gohome.git + + If you have local work here, re-apply it against weka/gohome. +============================================================================ + +DEPRECATED +echo "::error::weka/gohomecli is deprecated - build from https://github.com/weka/gohome instead" >&2 +exit 1 + +set -e # Exit on any error + BUILD_VERSION=$1 BUILD_TIME=$(date +'%Y-%m-%d_%T') + +echo "Building homecli version: ${BUILD_VERSION:-}" + LD_FLAGS="-X main.BuildVersion=$BUILD_VERSION -X main.BuildTime=$BUILD_TIME" -CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$LD_FLAGS" -o bin/homecli_linux_amd64 cmd/homecli/*.go -CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$LD_FLAGS" -o bin/homecli_darwin_amd64 cmd/homecli/*.go +LD_FLAGS="$LD_FLAGS -s -w" + +echo "Building Linux amd64 binary..." +if ! CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$LD_FLAGS" -o bin/homecli_linux_amd64 cmd/homecli/*.go; then + echo "::error::Failed to build Linux binary" + exit 1 +fi + +echo "Building macOS amd64 binary..." +if ! CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="$LD_FLAGS" -o bin/homecli_darwin_amd64 cmd/homecli/*.go; then + echo "::error::Failed to build macOS binary" + exit 1 +fi + +# Add UPX compression (only on Linux, only for Linux binary) +# UPX doesn't support macOS binaries and the Linux UPX binary can't run on macOS + +if [ "$(uname)" = "Linux" ]; then + echo "Compressing Linux binary with UPX..." + UPX_VERSION="${UPX_VERSION:-4.2.2}" + UPX_PLATFORM="${UPX_PLATFORM:-amd64_linux}" + # SHA256 checksum verified from official UPX 4.2.2 release + UPX_SHA256="915c8e844f835de03b9cc311ff185aedec79d757aee9d7133a528b9e89c463bb" + + UPX_ARCHIVE="upx-${UPX_VERSION}-${UPX_PLATFORM}.tar.xz" + + if [ ! -d "upx-${UPX_VERSION}-${UPX_PLATFORM}" ]; then + echo "Downloading UPX ${UPX_VERSION}..." + if ! wget -q "https://github.com/upx/upx/releases/download/v${UPX_VERSION}/${UPX_ARCHIVE}"; then + echo "::error::Failed to download UPX" + exit 1 + fi + + echo "Verifying UPX checksum..." + ACTUAL_SHA256=$(sha256sum "$UPX_ARCHIVE" | cut -d' ' -f1) + if [ "$ACTUAL_SHA256" != "$UPX_SHA256" ]; then + echo "::error::UPX checksum verification failed!" + echo "Expected: $UPX_SHA256" + echo "Actual: $ACTUAL_SHA256" + rm -f "$UPX_ARCHIVE" + exit 1 + fi + echo "Checksum verified." + + if ! tar xf "$UPX_ARCHIVE" "upx-${UPX_VERSION}-${UPX_PLATFORM}/upx"; then + echo "::error::Failed to extract UPX" + exit 1 + fi + fi + + if ! "upx-${UPX_VERSION}-${UPX_PLATFORM}/upx" bin/homecli_linux_amd64; then + echo "::error::Failed to compress Linux binary with UPX" + exit 1 + fi +else + echo "Skipping UPX compression (not running on Linux)" +fi + +echo "" +echo "Build completed successfully!" diff --git a/cmd/homecli/deprecated.go b/cmd/homecli/deprecated.go new file mode 100644 index 0000000..ab801bd --- /dev/null +++ b/cmd/homecli/deprecated.go @@ -0,0 +1,13 @@ +package main + +// This repository is DEPRECATED. The Weka Home CLI has moved to weka/gohome: +// +// git clone git@github.com:weka/gohome.git +// +// The identifiers below are intentionally undefined so that any attempt to +// build this repository fails with the new location in the compiler output. +// Do not "fix" this file - move your work to weka/gohome instead. +const ( + _ = THIS_REPOSITORY_IS_DEPRECATED_AND_NO_LONGER_BUILDS + _ = THE_WEKA_HOME_CLI_HAS_MOVED_TO_github_com_weka_gohome +) diff --git a/deploy.sh b/deploy.sh index 90e3388..9c8c3af 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,5 +1,26 @@ #!/usr/bin/env bash +# ============================================================================ +# weka/gohomecli is DEPRECATED. This script intentionally refuses to run. +# Do not remove this guard; move your work to weka/gohome instead. +# ============================================================================ +cat >&2 <<'DEPRECATED' + +============================================================================ + weka/gohomecli is DEPRECATED - it no longer builds. + + The Weka Home CLI has moved to: https://github.com/weka/gohome + + You are building from a stale clone. Get the new repository: + + $ git clone git@github.com:weka/gohome.git + + If you have local work here, re-apply it against weka/gohome. +============================================================================ + +DEPRECATED +exit 1 + set -e . get_version.sh