diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7f7e8592..56a36d8f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,12 +53,20 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.25' - - name: Build for ${{ matrix.goos }}/${{ matrix.goarch }} + - name: Build bridge for ${{ matrix.goos }}/${{ matrix.goarch }} env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} - VERSION: ${{ needs.version.outputs.new_version }} - run: sh build.sh + run: | + # v3.7.0 is the end-of-life Canasta-CLI Go release. The repo's + # full Cobra build (build.sh, cmd/, internal/) is preserved as + # archived dead code — releases from this point ship only the + # minimal bridge program from ./bridge, which prints a notice + # directing users to install Canasta CLI 4.0.0+ via + # get.canasta.wiki. See bridge/main.go for full context. + mkdir -p build + go build -trimpath -ldflags="-s -w" \ + -o build/canasta-${{ matrix.goos }}-${{ matrix.goarch }} ./bridge - name: Upload executable uses: actions/upload-artifact@v4 with: diff --git a/.gitignore b/.gitignore index 42d9e7b8..7fdedf6e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ # Build output directory build/ +dist/ # Test binary, built with `go test -c` *.test diff --git a/Makefile b/Makefile index 69f0871f..3f42fb02 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,26 @@ install: build clean: @echo "Cleaning build artifacts..." - @rm -rf build/ + @rm -rf build/ dist/ @echo "Clean complete." +# Cross-compile the Go-to-Ansible bridge for the four selfupdate-supported +# OS/arch combos. Output goes to dist/bridge/canasta--; those +# files become release assets on this repo's v3.7.0 release and are +# vendored into the Canasta-Ansible repo for re-use on every Canasta CLI +# 4.x.x release. See https://github.com/CanastaWiki/Canasta-Ansible/blob/main/canasta-ansible-release-plan.md +# for the full release plan. +bridge: + @mkdir -p dist/bridge + @for platform in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64; do \ + os=$${platform%%/*}; arch=$${platform##*/}; \ + echo "Building bridge for $$os/$$arch..."; \ + GOOS=$$os GOARCH=$$arch go build -trimpath -ldflags="-s -w" \ + -o dist/bridge/canasta-$$os-$$arch ./bridge; \ + done + @echo "Bridge binaries built in dist/bridge/" + @ls -lh dist/bridge/ + prepare-lint: @if ! hash golangci-lint 2>/dev/null; then printf "\e[1;36m>> Installing golangci-lint (this may take a while)...\e[0m\n"; go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; fi @@ -55,6 +72,7 @@ help: @printf "\e[1mBuild\e[0m\n" @printf " \e[36mbuild\e[0m Build binary (outputs to build/ directory and creates symlink).\n" @printf " \e[36minstall\e[0m Build and install to /usr/local/bin/ (requires sudo).\n" + @printf " \e[36mbridge\e[0m Cross-compile the Go-to-Ansible bridge for 4 OS/arch combos (outputs to dist/bridge/).\n" @printf " \e[36mclean\e[0m Remove build artifacts and symlink.\n" @printf "\n" @printf "\e[1mTest\e[0m\n" @@ -67,4 +85,4 @@ help: @printf " \e[36mcoverage-report\e[0m Merge unit and integration profiles and show combined coverage.\n" @printf "\n" -.PHONY: build install clean prepare-lint lint test-cover integration-cover coverage-report help +.PHONY: build install clean bridge prepare-lint lint test-cover integration-cover coverage-report help diff --git a/VERSION b/VERSION index 4a788a01..7c69a55d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.6.3 +3.7.0 diff --git a/bridge/main.go b/bridge/main.go new file mode 100644 index 00000000..8588d09e --- /dev/null +++ b/bridge/main.go @@ -0,0 +1,40 @@ +// Package main is the Canasta-CLI Go-to-Ansible bridge. +// +// Old Canasta-CLI Go binaries' selfupdate logic is hardcoded to query +// api.github.com/repos/CanastaWiki/Canasta-CLI/releases/latest and +// download canasta-- from whichever release is "latest." +// Attaching this minimal bridge as a release asset (a) to v3.7.0 of +// this repo, and (b) to every release of the Ansible-based Canasta CLI +// (the renamed Canasta-Ansible repo, which now occupies the +// "Canasta-CLI" slot on GitHub) keeps the migration path working +// indefinitely. +// +// Any invocation of this binary prints the migration message and +// exits. Once installed via the old binary's selfupdate, running any +// canasta command becomes a forcing function for the user to run the +// install script. +package main + +import "fmt" + +func main() { + fmt.Println(`The Go implementation of Canasta CLI that you have been using has been superseded by a python/Ansible implementation (version 4.0.0+). + +Your registered instances and their data continue to work without changes. + +To install the new Canasta CLI, run ONE of: + + # Docker mode (default — only Docker required on the host): + curl -fsSL https://get.canasta.wiki | bash + + # Native mode (requires Python 3.10+ and git on the host; + # Ansible is installed automatically into a Python venv): + curl -fsSL https://get.canasta.wiki | bash -s -- --native + +Docker mode is the simplest setup. Native mode runs Ansible directly +on the host (faster startup, easier playbook debugging). + +See https://canasta.wiki/wiki/Help:Installation for details. + +After install, run 'canasta version' to confirm you're on 4.0.0 or later.`) +}