From 297c4db78d99eb0a89743d2b77129545a3c17556 Mon Sep 17 00:00:00 2001 From: Justin Brooks Date: Wed, 13 Nov 2024 12:58:02 -0500 Subject: [PATCH] set binary to ctrlc --- .goreleaser.yaml | 3 ++- README.md | 3 +++ action.yml | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 README.md create mode 100644 action.yml diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 821de93..e17d5dd 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -26,12 +26,13 @@ builds: tags: - containers_image_openpgp main: ./cmd/ctrlc + binary: ctrlc archives: - format: tar.gz # this name template makes the OS and Arch compatible with the results of `uname`. name_template: >- - {{ .ProjectName }}_ + ctrlc_ {{- title .Os }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ff190a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# CtrlC CLI + +This is a CLI for CtrlPlane. diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..907c2f6 --- /dev/null +++ b/action.yml @@ -0,0 +1,36 @@ +name: Install Go Binary +description: Installs a Go binary from a GitHub repository + +inputs: + binary: + description: "Name of the binary to install" + required: true + default: "ctrlc" + version: + description: "Version of the binary to install" + required: true + repo: + description: "GitHub repository containing the binary (format: owner/repo)" + required: true + default: "ctrlplanedev/ctrlc" +runs: + using: "composite" + steps: + - name: Download binary + shell: bash + run: | + OS=$(uname -s | tr '[:upper:]' '[:lower:]') + ARCH=$(uname -m) + if [ "$ARCH" = "x86_64" ]; then + ARCH="x86_64" + elif [ "$ARCH" = "aarch64" ]; then + ARCH="arm64" + fi + + BINARY_NAME="${{ inputs.binary }}_${OS}_${ARCH}" + DOWNLOAD_URL="https://github.com/${{ inputs.repo }}/releases/download/${{ inputs.version }}/cli_${BINARY_NAME}.tar.gz" + + curl -L $DOWNLOAD_URL -o binary.tar.gz + tar xzf binary.tar.gz + chmod +x ${{ inputs.binary }} + sudo mv ${{ inputs.binary }} /usr/local/bin/