diff --git a/.goreleaser.yml b/.goreleaser.yml index a96f7d7..d48747a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -86,36 +86,36 @@ release: prerelease: auto mode: replace header: | - ## Conjure {{ .Tag }} ({{ .Date }}) + ## Conjure {{ .Version }} ({{ .Date }}) Welcome to this new release of Conjure! footer: | ## Installation - ### Binary Installation - - Download the appropriate binary for your platform from the assets below. - - ### Quick Install Script (Linux/macOS) + ### One-line install (Linux & macOS) ```bash - # Linux - curl -L https://github.com/WizardOpsTech/conjure/releases/download/{{ .Tag }}/conjure_{{ .Tag }}_Linux_x86_64.tar.gz | tar xz - sudo mv conjure /usr/local/bin/ + curl -sfL https://raw.githubusercontent.com/WizardOpsTech/conjure/main/install.sh | sh + ``` - # macOS (Intel) - curl -L https://github.com/WizardOpsTech/conjure/releases/download/{{ .Tag }}/conjure_{{ .Tag }}_Darwin_x86_64.tar.gz | tar xz - sudo mv conjure /usr/local/bin/ + ### One-line install (Windows PowerShell) - # macOS (Apple Silicon) - curl -L https://github.com/WizardOpsTech/conjure/releases/download/{{ .Tag }}/conjure_{{ .Tag }}_Darwin_arm64.tar.gz | tar xz - sudo mv conjure /usr/local/bin/ + ```powershell + irm https://raw.githubusercontent.com/WizardOpsTech/conjure/main/install.ps1 | iex ``` - ### Windows + ### Manual binary download + + Download the archive for your platform from the assets below, extract it, and move the binary to a directory on your PATH. - Download the ZIP file, extract it, and add the executable to your PATH. + | Platform | Archive | + |---|---| + | Linux x86_64 | `conjure_{{ .Version }}_Linux_x86_64.tar.gz` | + | Linux arm64 | `conjure_{{ .Version }}_Linux_arm64.tar.gz` | + | macOS Intel | `conjure_{{ .Version }}_Darwin_x86_64.tar.gz` | + | macOS Apple Silicon | `conjure_{{ .Version }}_Darwin_arm64.tar.gz` | + | Windows x86_64 | `conjure_{{ .Version }}_Windows_x86_64.zip` | --- - **Full Changelog**: https://github.com/WizardOpsTech/conjure/compare/{{ .PreviousTag }}...{{ .Tag }} + **Full Changelog**: https://github.com/WizardOpsTech/conjure/compare/{{ .PreviousTag }}...{{ .Version }} diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..60f7e06 --- /dev/null +++ b/install.ps1 @@ -0,0 +1,52 @@ +# Conjure installer — Windows (PowerShell 5.1+) +# Usage: irm https://raw.githubusercontent.com/WizardOpsTech/conjure/main/install.ps1 | iex +$ErrorActionPreference = 'Stop' + +# Windows arm64 is not supported by the published binaries +if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') { + Write-Error "Windows arm64 is not currently supported. Use WSL2 and the Linux installer instead:`n curl -sfL https://raw.githubusercontent.com/WizardOpsTech/conjure/main/install.sh | sh" + exit 1 +} + +# Fetch latest release info from the GitHub API +Write-Host "Fetching latest Conjure release..." +$release = Invoke-RestMethod "https://api.github.com/repos/WizardOpsTech/conjure/releases/latest" +$tag = $release.tag_name # e.g. "v1.0.0" +$version = $tag.TrimStart('v') # e.g. "1.0.0" + +$archive = "conjure_${version}_Windows_x86_64.zip" +$url = "https://github.com/WizardOpsTech/conjure/releases/download/$tag/$archive" + +Write-Host "Installing conjure $version for Windows x86_64..." + +# Download to a unique temp directory +$tmp = Join-Path $env:TEMP "conjure-install-$([System.IO.Path]::GetRandomFileName())" +$zipPath = Join-Path $tmp "conjure.zip" +New-Item -ItemType Directory -Force -Path $tmp | Out-Null + +try { + Invoke-WebRequest -Uri $url -OutFile $zipPath -UseBasicParsing + Expand-Archive -Path $zipPath -DestinationPath $tmp -Force + + # Install to %USERPROFILE%\bin — no admin required + $installDir = Join-Path $env:USERPROFILE "bin" + New-Item -ItemType Directory -Force -Path $installDir | Out-Null + Move-Item -Force (Join-Path $tmp "conjure.exe") (Join-Path $installDir "conjure.exe") + + # Add the install directory to the user PATH if it is not already there + $userPath = [Environment]::GetEnvironmentVariable("PATH", "User") + if ($null -eq $userPath) { $userPath = "" } + if ($userPath -notlike "*$installDir*") { + [Environment]::SetEnvironmentVariable("PATH", "$userPath;$installDir", "User") + Write-Host "" + Write-Host "conjure $version installed to $installDir" + Write-Host "Added $installDir to your PATH." + Write-Host "Restart your terminal, then run: conjure --version" + } else { + Write-Host "" + Write-Host "conjure $version installed to $installDir" + Write-Host "Run: conjure --version" + } +} finally { + Remove-Item -Recurse -Force $tmp -ErrorAction SilentlyContinue +} diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..744e79e --- /dev/null +++ b/install.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env sh +# Conjure installer — Linux & macOS +# Usage: curl -sfL https://raw.githubusercontent.com/WizardOpsTech/conjure/main/install.sh | sh +set -e + +# Detect OS +OS=$(uname -s) +case "$OS" in + Linux) OS_SLUG="Linux" ;; + Darwin) OS_SLUG="Darwin" ;; + *) + echo "Unsupported OS: $OS" + echo "Windows users: run this in PowerShell instead:" + echo " irm https://raw.githubusercontent.com/WizardOpsTech/conjure/main/install.ps1 | iex" + exit 1 + ;; +esac + +# Detect architecture +ARCH=$(uname -m) +case "$ARCH" in + x86_64) ARCH_SLUG="x86_64" ;; + aarch64|arm64) ARCH_SLUG="arm64" ;; + *) + echo "Unsupported architecture: $ARCH" + exit 1 + ;; +esac + +# Fetch latest release tag from the GitHub API +echo "Fetching latest Conjure release..." +TAG=$(curl -sfL "https://api.github.com/repos/WizardOpsTech/conjure/releases/latest" \ + | grep '"tag_name"' \ + | head -1 \ + | cut -d'"' -f4) + +if [ -z "$TAG" ]; then + echo "Failed to fetch release info. Check your internet connection and try again." + exit 1 +fi + +VERSION="${TAG#v}" +ARCHIVE="conjure_${VERSION}_${OS_SLUG}_${ARCH_SLUG}.tar.gz" +URL="https://github.com/WizardOpsTech/conjure/releases/download/${TAG}/${ARCHIVE}" + +echo "Installing conjure ${VERSION} for ${OS_SLUG}/${ARCH_SLUG}..." + +# Download and extract the binary to a temp directory +TMP=$(mktemp -d) +trap 'rm -rf "$TMP"' EXIT + +curl -sfL "$URL" | tar xzf - -C "$TMP" conjure +chmod +x "$TMP/conjure" + +# Install to /usr/local/bin — use sudo if the directory is not writable +INSTALL_DIR="/usr/local/bin" +if [ -w "$INSTALL_DIR" ]; then + mv "$TMP/conjure" "$INSTALL_DIR/conjure" +else + echo "Installing to $INSTALL_DIR requires elevated permissions..." + sudo mv "$TMP/conjure" "$INSTALL_DIR/conjure" +fi + +echo "" +echo "conjure ${VERSION} installed to ${INSTALL_DIR}/conjure" +echo "Run: conjure --version" diff --git a/project.yaml b/project.yaml new file mode 100644 index 0000000..53df910 --- /dev/null +++ b/project.yaml @@ -0,0 +1,17 @@ +name: conjure +type: cli +description: Template-driven configuration generation CLI for DevOps, platform engineers, and developers. +visibility: public +indexing: none +stack: + - go + - cobra + - viper + - bubbletea +standards: + - go + - cli + - testing + - logging + - error-handling + - conjure-release-contract