From 715ab79600ac25c29839627d0c8c1b762c76a32a Mon Sep 17 00:00:00 2001 From: Vlad Durnea Date: Sat, 31 Oct 2026 08:51:20 +0200 Subject: [PATCH] better-setup-go v1: pinned static Go, musl-safe --- README.md | 10 ++++++++++ action.yml | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 README.md create mode 100644 action.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..712137c --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# better-setup-go + +Fork of the setup-go recipe for git.madapes.com runners: installs the **pinned** Go from the +official static tarball. No versions-manifest round-trip, no glibc runtime requirement — +works on musl runner images where nothing needs installing first. + +```yaml +- uses: https://git.madapes.com/actions/better-setup-go@v1 + with: { go-version: "1.27.0" } +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..8b72565 --- /dev/null +++ b/action.yml @@ -0,0 +1,22 @@ +name: better-setup-go +description: Install a pinned Go toolchain from the official static tarball — musl-safe, no manifest fetches, Forgejo/act runner safe. +inputs: + go-version: + description: Exact Go version to install (e.g. 1.27.0). + required: true +runs: + using: composite + steps: + - shell: bash + run: | + set -euo pipefail + v="${{ inputs.go-version }}" + case "$(uname -m)" in + x86_64|amd64) arch=amd64 ;; + aarch64|arm64) arch=arm64 ;; + *) echo "better-setup-go: unsupported arch $(uname -m)" >&2; exit 1 ;; + esac + curl -fsSL "https://go.dev/dl/go${v}.linux-${arch}.tar.gz" | tar -xz -C /usr/local + ln -sf /usr/local/go/bin/go /usr/local/bin/go + ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt + go version